aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/db_definitions/postgresql.sql
blob: ab392c5688d54c521e26f469486cf39a9770cff7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
SET search_path = public, pg_catalog;

CREATE TABLE accounts (
    id serial,
    firm_id integer,
    credit_limit integer,
    PRIMARY KEY (id)
);
SELECT setval('accounts_id_seq', 100);

CREATE TABLE companies (
    id serial,
    "type" character varying(50),
    "ruby_type" character varying(50),
    firm_id integer,
    name character varying(50),
    client_of integer,
    rating integer default 1,
    PRIMARY KEY (id)
);
SELECT setval('companies_id_seq', 100);

CREATE TABLE developers_projects (
    developer_id integer NOT NULL,
    project_id integer NOT NULL,
    joined_on date
);

CREATE TABLE developers (
    id serial,
    name character varying(100),
    salary integer DEFAULT 70000,
    PRIMARY KEY (id)
);
SELECT setval('developers_id_seq', 100);

CREATE TABLE projects (
    id serial,
    name character varying(100),
    PRIMARY KEY (id)
);
SELECT setval('projects_id_seq', 100);

CREATE TABLE topics (
    id serial,
    title character varying(255),
    author_name character varying(255),
    author_email_address character varying(255),
    written_on timestamp without time zone,
    bonus_time time,
    last_read date,
    content text,
    replies_count integer default 0,
    parent_id integer,
    "type" character varying(50),
    approved smallint DEFAULT 1,
    PRIMARY KEY (id)
);
SELECT setval('topics_id_seq', 100);

CREATE TABLE customers (
    id serial,
    name character varying,
    balance integer default 0,
    address_street character varying,
    address_city character varying,
    address_country character varying,
    gps_location character varying,
    PRIMARY KEY (id)
);
SELECT setval('customers_id_seq', 100);

CREATE TABLE movies (
    movieid serial,
    name text,
    PRIMARY KEY (movieid)
);

CREATE TABLE subscribers (
    nick text NOT NULL,
    name text,
    PRIMARY KEY (nick)
);

CREATE TABLE booleantests (
    id serial,
    value boolean,
    PRIMARY KEY (id)
);

CREATE TABLE defaults (
    id serial,
    modified_date date default CURRENT_DATE,
    fixed_date date default '2004-01-01',
    modified_time timestamp default CURRENT_TIMESTAMP,
    fixed_time timestamp default '2004-01-01 00:00:00.000000-00',
    char1 char(1) default 'Y',
    char2 character varying(50) default 'a varchar field',
    char3 text default 'a text field'
);

CREATE TABLE auto_id_tests (
    auto_id serial,
    value integer,
    PRIMARY KEY (auto_id)
);

CREATE TABLE entrants (
  id serial,
  name text,
  course_id integer
);

CREATE TABLE colnametests (
  id serial,
  "references" integer NOT NULL
);

CREATE TABLE mixins (
  id serial,
  parent_id integer,
  type character varying,  
  pos integer,
  lft integer,
  rgt integer,
  root_id integer,  
  created_at timestamp,
  updated_at timestamp,
  PRIMARY KEY  (id)
);

CREATE TABLE people (
  id serial,
  first_name text,
  lock_version integer default 0,
  PRIMARY KEY  (id)
);

CREATE TABLE binaries ( 
  id serial , 
  data bytea,
  PRIMARY KEY (id)
);

CREATE TABLE computers (
  id serial,
  developer integer NOT NULL
);