odbc-rails 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -0
- data/NEWS +3 -0
- data/README +4 -5
- data/lib/active_record/connection_adapters/odbc_adapter.rb +29 -15
- data/lib/active_record/vendor/odbcext_postgresql.rb +45 -69
- data/support/test/base_test.rb +1 -1
- data/support/test/migration_test.rb +1 -1
- data/test/fixtures/db_definitions/postgresql.drop.sql +34 -0
- data/test/fixtures/db_definitions/postgresql.sql +248 -0
- data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
- data/test/fixtures/db_definitions/postgresql2.sql +5 -0
- metadata +6 -2
data/ChangeLog
CHANGED
data/NEWS
CHANGED
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
(C) 2006 OpenLink Software
|
4
4
|
|
5
|
-
|
5
|
+
09-Jan-2007
|
6
6
|
|
7
7
|
|
8
8
|
== Status
|
@@ -18,7 +18,7 @@ its own adapter.
|
|
18
18
|
It currently supports Ingres r3, Informix 9.3 or later, Oracle 10g,
|
19
19
|
MySQL 5 and OpenLink's Virtuoso
|
20
20
|
(Open Source Edition[http://virtuoso.openlinksw.com]),
|
21
|
-
SQL Server 2000, Sybase ASE 15, DB2 v9
|
21
|
+
SQL Server 2000, Sybase ASE 15, DB2 v9, Progress v8/9/10 and PostgreSQL 8.2.
|
22
22
|
|
23
23
|
Testing to date has been limited to the ROR 'Expenses' sample
|
24
24
|
application described at http://developer.apple.com/tools/rubyonrails.html
|
@@ -100,12 +100,11 @@ Install the odbc-rails gem by running:
|
|
100
100
|
Enable loading of the adapter by editing your Rails project's
|
101
101
|
config/environment.rb script:
|
102
102
|
|
103
|
-
|
104
|
-
the line
|
103
|
+
* Add a +require+ to your config/environment.rb immediately after the line
|
105
104
|
|
106
105
|
require File.join(File.dirname(__FILE__), 'boot')
|
107
106
|
|
108
|
-
|
107
|
+
i.e.
|
109
108
|
|
110
109
|
require File.join(File.dirname(__FILE__), 'boot')
|
111
110
|
require 'odbc_adapter'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id: odbc_adapter.rb,v 1.
|
2
|
+
# $Id: odbc_adapter.rb,v 1.3 2007/01/09 10:11:40 source Exp $
|
3
3
|
#
|
4
4
|
# OpenLink ODBC Adapter for Ruby on Rails
|
5
5
|
# Copyright (C) 2006 OpenLink Software
|
@@ -57,12 +57,12 @@ begin
|
|
57
57
|
# The ODBC adapter requires the Ruby ODBC module (version 0.9991 or
|
58
58
|
# later), available from http://raa.ruby-lang.org/project/ruby-odbc
|
59
59
|
#
|
60
|
-
# == Status at
|
60
|
+
# == Status at 09-Jan-2007
|
61
61
|
#
|
62
62
|
# The current adapter supports Ingres r3, Informix 9.3 or later,
|
63
63
|
# Virtuoso (Open-Source Edition) 4.5, Oracle 10g, MySQL 5,
|
64
|
-
# SQL Server 2000, Sybase ASE 15, DB2 v9, Progress 9/10 (SQL-92 engine)
|
65
|
-
#
|
64
|
+
# SQL Server 2000, Sybase ASE 15, DB2 v9, Progress 9/10 (SQL-92 engine),
|
65
|
+
# Progress 8 (SQL-89 engine) and PostgreSQL 8.2
|
66
66
|
#
|
67
67
|
# == Testing Environments
|
68
68
|
#
|
@@ -71,7 +71,8 @@ begin
|
|
71
71
|
# The iODBC Driver Manager was used on Linux and Mac OS X.
|
72
72
|
#
|
73
73
|
# Databases supported using OpenLink ODBC drivers:
|
74
|
-
# * Informix, Ingres, Oracle, MySQL, SQL Server, Sybase, DB2, Progress
|
74
|
+
# * Informix, Ingres, Oracle, MySQL, SQL Server, Sybase, DB2, Progress,
|
75
|
+
# PostgreSQL
|
75
76
|
# Databases supported using the database's own native ODBC driver:
|
76
77
|
# * Virtuoso, MySQL, Informix
|
77
78
|
#
|
@@ -85,7 +86,6 @@ begin
|
|
85
86
|
# More information can be found at:
|
86
87
|
# * http://rubyforge.org/projects/odbc-rails/
|
87
88
|
# * http://odbc-rails.openlinksw.com
|
88
|
-
# * http://virtuoso.openlinksw.com/wiki/main/OdbcRails/RailsAdapterWeb
|
89
89
|
# * http://sourceforge.net/projects/virtuoso/
|
90
90
|
#
|
91
91
|
# Maintainer: Carl Blakeley (mailto:cblakeley@openlinksw.co.uk)
|
@@ -253,6 +253,15 @@ begin
|
|
253
253
|
:supports_count_distinct => true
|
254
254
|
}
|
255
255
|
},
|
256
|
+
:postgresql => {
|
257
|
+
:any_version => {
|
258
|
+
:primary_key => "serial primary key",
|
259
|
+
:has_autoincrement_col => true,
|
260
|
+
:supports_migrations => true,
|
261
|
+
:supports_schema_names => false,
|
262
|
+
:supports_count_distinct => true
|
263
|
+
}
|
264
|
+
},
|
256
265
|
:progress => {
|
257
266
|
:any_version => {
|
258
267
|
:primary_key => "integer not null primary key",
|
@@ -497,8 +506,8 @@ begin
|
|
497
506
|
@logger.unknown("args=[#{value}]") if @@trace
|
498
507
|
case value
|
499
508
|
when String
|
500
|
-
if column && column.type == :binary &&
|
501
|
-
"'#{
|
509
|
+
if column && column.type == :binary && self.respond_to?(:string_to_binary)
|
510
|
+
"'#{string_to_binary(value)}'"
|
502
511
|
elsif (column && [:integer, :float].include?(column.type)) ||
|
503
512
|
(column.nil? && @convert_numeric_literals &&
|
504
513
|
(value =~ /^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/))
|
@@ -864,9 +873,9 @@ begin
|
|
864
873
|
# Returns the default sequence name for a table.
|
865
874
|
# Used for databases which don't support an autoincrementing column
|
866
875
|
# type, but do support sequences.
|
867
|
-
def default_sequence_name(table,
|
876
|
+
def default_sequence_name(table, column)
|
868
877
|
@logger.unknown("ODBCAdapter#default_sequence_name>") if @@trace
|
869
|
-
@logger.unknown("args=[#{table}|#{
|
878
|
+
@logger.unknown("args=[#{table}|#{column}]") if @@trace
|
870
879
|
"#{table}_seq"
|
871
880
|
end
|
872
881
|
|
@@ -915,11 +924,15 @@ begin
|
|
915
924
|
currentUser = @dsInfo.info[ODBC::SQL_USER_NAME]
|
916
925
|
stmt = @connection.tables
|
917
926
|
resultSet = stmt.fetch_all || []
|
918
|
-
resultSet.each do |row|
|
927
|
+
resultSet.each do |row|
|
928
|
+
schemaName = row[1]
|
929
|
+
tblName = row[2]
|
930
|
+
tblType = row[3]
|
931
|
+
next if respond_to?("table_filter") && table_filter(schemaName, tblName, tblType)
|
919
932
|
if @@dbmsLookups.get_info(@dbmsName, @dbmsMajorVer, :supports_schema_names)
|
920
|
-
tblNames << activeRecIdentCase(
|
933
|
+
tblNames << activeRecIdentCase(tblName) if schemaName.casecmp(currentUser) == 0
|
921
934
|
else
|
922
|
-
tblNames << activeRecIdentCase(
|
935
|
+
tblNames << activeRecIdentCase(tblName)
|
923
936
|
end
|
924
937
|
end
|
925
938
|
stmt.drop
|
@@ -966,8 +979,9 @@ begin
|
|
966
979
|
elsif colDefault =~ /^\((.*)\)$/ # SQL Server numeric default
|
967
980
|
colDefault = $1
|
968
981
|
# ODBC drivers should return string column defaults in quotes
|
969
|
-
# Oracle
|
970
|
-
|
982
|
+
# - Oracle includes a trailing space.
|
983
|
+
# - PostgreSQL may return '<default>::character varying'
|
984
|
+
elsif colDefault =~ /^'(.*)'[ :].*$/
|
971
985
|
colDefault = $1
|
972
986
|
#TODO: HACKS for Progress
|
973
987
|
elsif @dbmsName == :progress || @dbmsName == :progress89
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id: odbcext_postgresql.rb,v 1.
|
2
|
+
# $Id: odbcext_postgresql.rb,v 1.2 2007/01/09 10:11:40 source Exp $
|
3
3
|
#
|
4
4
|
# OpenLink ODBC Adapter for Ruby on Rails
|
5
5
|
# Copyright (C) 2006 OpenLink Software
|
@@ -32,15 +32,22 @@ module ODBCExt
|
|
32
32
|
|
33
33
|
# #last_insert_id must be implemented for any database which returns
|
34
34
|
# false from #prefetch_primary_key?
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
|
36
|
+
def last_insert_id(table, sequence_name, stmt = nil)
|
37
|
+
select_value("select currval('#{sequence_name}')", 'last_insert_id')
|
38
|
+
end
|
38
39
|
|
39
40
|
# ------------------------------------------------------------------------
|
40
41
|
# Optional methods
|
41
42
|
#
|
42
43
|
# These are supplied for a DBMS only if necessary.
|
43
44
|
# ODBCAdapter tests for optional methods using Object#respond_to?
|
45
|
+
|
46
|
+
# Filter for ODBCAdapter#tables
|
47
|
+
# Omits table from #tables if table_filter returns true
|
48
|
+
def table_filter(schemaName, tblName, tblType)
|
49
|
+
["information_schema", "pg_catalog"].include?(schemaName) || tblType !~ /TABLE/i
|
50
|
+
end
|
44
51
|
|
45
52
|
# Pre action for ODBCAdapter#insert
|
46
53
|
# def pre_insert(sql, name, pk, id_value, sequence_name)
|
@@ -50,22 +57,45 @@ module ODBCExt
|
|
50
57
|
# def post_insert(sql, name, pk, id_value, sequence_name)
|
51
58
|
# end
|
52
59
|
|
60
|
+
def string_to_binary(value)
|
61
|
+
# Escape data prior to insert into a bytea column
|
62
|
+
if value
|
63
|
+
res = ''
|
64
|
+
value.each_byte { |b| res << sprintf('\\\\%03o', b) }
|
65
|
+
res
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
53
69
|
# ------------------------------------------------------------------------
|
54
70
|
# Method redefinitions
|
55
71
|
#
|
56
72
|
# DBMS specific methods which override the default implementation
|
57
73
|
# provided by the ODBCAdapter core.
|
58
74
|
|
59
|
-
def
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
75
|
+
def quoted_true
|
76
|
+
"'t'"
|
77
|
+
end
|
78
|
+
|
79
|
+
def quoted_false
|
80
|
+
"'f'"
|
81
|
+
end
|
82
|
+
|
83
|
+
def quote_string(string)
|
84
|
+
@logger.unknown("ODBCAdapter#quote_string>") if @trace
|
85
|
+
string.gsub(/\\/, '\&\&').gsub(/'/, "''")
|
67
86
|
end
|
68
87
|
|
88
|
+
def default_sequence_name(table, column)
|
89
|
+
@logger.unknown("ODBCAdapter#default_sequence_name>") if @trace
|
90
|
+
@logger.unknown("args=[#{table}|#{column}]") if @trace
|
91
|
+
"#{table}_#{column}_seq"
|
92
|
+
end
|
93
|
+
|
94
|
+
def indexes(table_name, name = nil)
|
95
|
+
# Exclude primary key indexes
|
96
|
+
super(table_name, name).delete_if { |i| i.unique && i.name =~ /_pkey$/i }
|
97
|
+
end
|
98
|
+
|
69
99
|
def rename_table(name, new_name)
|
70
100
|
@logger.unknown("ODBCAdapter#rename_table>") if @trace
|
71
101
|
execute "ALTER TABLE #{name} RENAME TO #{new_name}"
|
@@ -91,7 +121,7 @@ module ODBCExt
|
|
91
121
|
|
92
122
|
def change_column(table_name, column_name, type, options = {})
|
93
123
|
@logger.unknown("ODBCAdapter#change_column>") if @trace
|
94
|
-
execute "ALTER TABLE #{table_name} ALTER #{column_name} TYPE #{type}"
|
124
|
+
execute "ALTER TABLE #{table_name} ALTER #{column_name} TYPE #{type_to_sql(type, options[:limit])}"
|
95
125
|
change_column_default(table_name, column_name, options[:default]) unless options[:default].nil?
|
96
126
|
rescue Exception => e
|
97
127
|
@logger.unknown("exception=#{e}") if @trace
|
@@ -108,7 +138,7 @@ module ODBCExt
|
|
108
138
|
|
109
139
|
def rename_column(table_name, column_name, new_column_name)
|
110
140
|
@logger.unknown("ODBCAdapter#rename_column>") if @trace
|
111
|
-
execute "ALTER TABLE #{table_name} RENAME
|
141
|
+
execute "ALTER TABLE #{table_name} RENAME #{column_name} TO #{new_column_name}"
|
112
142
|
rescue Exception => e
|
113
143
|
@logger.unknown("exception=#{e}") if @trace
|
114
144
|
raise
|
@@ -116,64 +146,10 @@ module ODBCExt
|
|
116
146
|
|
117
147
|
def remove_index(table_name, options = {})
|
118
148
|
@logger.unknown("ODBCAdapter#remove_index>") if @trace
|
119
|
-
|
120
|
-
index_name = options[:name]
|
121
|
-
else
|
122
|
-
index_name = "#{table_name}_#{options}_index"
|
123
|
-
end
|
124
|
-
execute "DROP INDEX #{index_name}"
|
149
|
+
execute "DROP INDEX #{index_name(table_name, options)}"
|
125
150
|
rescue Exception => e
|
126
151
|
@logger.unknown("exception=#{e}") if @trace
|
127
152
|
raise
|
128
153
|
end
|
129
154
|
|
130
|
-
# ------------------------------------------------------------------------
|
131
|
-
# Private methods to support methods above
|
132
|
-
#
|
133
|
-
private
|
134
|
-
|
135
|
-
# Find a table's primary key and sequence.
|
136
|
-
def pk_and_sequence_for(table)
|
137
|
-
# First try looking for a sequence with a dependency on the
|
138
|
-
# given table's primary key.
|
139
|
-
result = select_all(<<-end_sql, 'PK and serial sequence')[0]
|
140
|
-
SELECT attr.attname, name.nspname, seq.relname
|
141
|
-
FROM pg_class seq,
|
142
|
-
pg_attribute attr,
|
143
|
-
pg_depend dep,
|
144
|
-
pg_namespace name,
|
145
|
-
pg_constraint cons
|
146
|
-
WHERE seq.oid = dep.objid
|
147
|
-
AND seq.relnamespace = name.oid
|
148
|
-
AND seq.relkind = 'S'
|
149
|
-
AND attr.attrelid = dep.refobjid
|
150
|
-
AND attr.attnum = dep.refobjsubid
|
151
|
-
AND attr.attrelid = cons.conrelid
|
152
|
-
AND attr.attnum = cons.conkey[1]
|
153
|
-
AND cons.contype = 'p'
|
154
|
-
AND dep.refobjid = '#{table}'::regclass
|
155
|
-
end_sql
|
156
|
-
|
157
|
-
if result.nil? or result.empty?
|
158
|
-
# If that fails, try parsing the primary key's default value.
|
159
|
-
# Support the 7.x and 8.0 nextval('foo'::text) as well as
|
160
|
-
# the 8.1+ nextval('foo'::regclass).
|
161
|
-
result = select_all(<<-end_sql, 'PK and custom sequence')[0]
|
162
|
-
SELECT attr.attname, name.nspname, split_part(def.adsrc, '\\\'', 2)
|
163
|
-
FROM pg_class t
|
164
|
-
JOIN pg_namespace name ON (t.relnamespace = name.oid)
|
165
|
-
JOIN pg_attribute attr ON (t.oid = attrelid)
|
166
|
-
JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)
|
167
|
-
JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])
|
168
|
-
WHERE t.oid = '#{table}'::regclass
|
169
|
-
AND cons.contype = 'p'
|
170
|
-
AND def.adsrc ~* 'nextval'
|
171
|
-
end_sql
|
172
|
-
end
|
173
|
-
# check for existence of . in sequence name as in public.foo_sequence. if it does not exist, join the current namespace
|
174
|
-
result.last['.'] ? [result.first, result.last] : [result.first, "#{result[1]}.#{result[2]}"]
|
175
|
-
rescue
|
176
|
-
nil
|
177
|
-
end
|
178
|
-
|
179
155
|
end # module
|
data/support/test/base_test.rb
CHANGED
@@ -985,7 +985,7 @@ class BasicsTest < Test::Unit::TestCase
|
|
985
985
|
|
986
986
|
def test_quote
|
987
987
|
if current_adapter?(:ODBCAdapter) && [:informix, :sybase].include?(ActiveRecord::Base.connection.dbmsName)
|
988
|
-
#
|
988
|
+
#Some databases only allow printable characters in VARCHAR columns.
|
989
989
|
author_name = "\\ \041 ' \n \\n \""
|
990
990
|
else
|
991
991
|
author_name = "\\ \001 ' \n \\n \""
|
@@ -247,7 +247,7 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|
247
247
|
|
248
248
|
begin
|
249
249
|
# Some DBs complain girlfriend column already exists on two consecutive add_column calls
|
250
|
-
unless current_adapter?(:ODBCAdapter) && [:informix, :oracle, :mysql, :microsoftsqlserver, :sybase].include?(ActiveRecord::Base.connection.dbmsName)
|
250
|
+
unless current_adapter?(:ODBCAdapter) && [:informix, :oracle, :mysql, :microsoftsqlserver, :sybase, :postgresql].include?(ActiveRecord::Base.connection.dbmsName)
|
251
251
|
Person.connection.add_column "people", "girlfriend", :string
|
252
252
|
end
|
253
253
|
Person.connection.add_column "people", "girlfriend", :string, :limit => 40
|
@@ -0,0 +1,34 @@
|
|
1
|
+
DROP SEQUENCE accounts_id_seq;
|
2
|
+
DROP TABLE accounts;
|
3
|
+
DROP TABLE funny_jokes;
|
4
|
+
DROP TABLE companies;
|
5
|
+
DROP SEQUENCE companies_nonstd_seq;
|
6
|
+
DROP TABLE topics;
|
7
|
+
DROP TABLE developers;
|
8
|
+
DROP TABLE projects;
|
9
|
+
DROP TABLE developers_projects;
|
10
|
+
DROP TABLE customers;
|
11
|
+
DROP TABLE orders;
|
12
|
+
DROP TABLE movies;
|
13
|
+
DROP TABLE subscribers;
|
14
|
+
DROP TABLE booleantests;
|
15
|
+
DROP TABLE auto_id_tests;
|
16
|
+
DROP TABLE entrants;
|
17
|
+
DROP TABLE colnametests;
|
18
|
+
DROP TABLE mixins;
|
19
|
+
DROP TABLE people;
|
20
|
+
DROP TABLE readers;
|
21
|
+
DROP TABLE binaries;
|
22
|
+
DROP TABLE computers;
|
23
|
+
DROP TABLE posts;
|
24
|
+
DROP TABLE comments;
|
25
|
+
DROP TABLE authors;
|
26
|
+
DROP TABLE tasks;
|
27
|
+
DROP TABLE categories;
|
28
|
+
DROP TABLE categories_posts;
|
29
|
+
DROP TABLE defaults;
|
30
|
+
DROP TABLE fk_test_has_fk;
|
31
|
+
DROP TABLE fk_test_has_pk;
|
32
|
+
DROP TABLE geometrics;
|
33
|
+
DROP TABLE keyboards;
|
34
|
+
DROP TABLE legacy_things;
|
@@ -0,0 +1,248 @@
|
|
1
|
+
CREATE SEQUENCE public.accounts_id_seq START 100;
|
2
|
+
|
3
|
+
CREATE TABLE accounts (
|
4
|
+
id integer DEFAULT nextval('public.accounts_id_seq'),
|
5
|
+
firm_id integer,
|
6
|
+
credit_limit integer,
|
7
|
+
PRIMARY KEY (id)
|
8
|
+
);
|
9
|
+
|
10
|
+
CREATE TABLE funny_jokes (
|
11
|
+
id serial,
|
12
|
+
name character varying(50)
|
13
|
+
);
|
14
|
+
|
15
|
+
CREATE SEQUENCE companies_nonstd_seq START 101;
|
16
|
+
|
17
|
+
CREATE TABLE companies (
|
18
|
+
id integer DEFAULT nextval('companies_nonstd_seq'),
|
19
|
+
"type" character varying(50),
|
20
|
+
"ruby_type" character varying(50),
|
21
|
+
firm_id integer,
|
22
|
+
name character varying(50),
|
23
|
+
client_of integer,
|
24
|
+
rating integer default 1,
|
25
|
+
PRIMARY KEY (id)
|
26
|
+
);
|
27
|
+
|
28
|
+
CREATE TABLE developers_projects (
|
29
|
+
developer_id integer NOT NULL,
|
30
|
+
project_id integer NOT NULL,
|
31
|
+
joined_on date,
|
32
|
+
access_level integer default 1
|
33
|
+
);
|
34
|
+
|
35
|
+
CREATE TABLE developers (
|
36
|
+
id serial,
|
37
|
+
name character varying(100),
|
38
|
+
salary integer DEFAULT 70000,
|
39
|
+
created_at timestamp,
|
40
|
+
updated_at timestamp,
|
41
|
+
PRIMARY KEY (id)
|
42
|
+
);
|
43
|
+
SELECT setval('developers_id_seq', 100);
|
44
|
+
|
45
|
+
CREATE TABLE projects (
|
46
|
+
id serial,
|
47
|
+
name character varying(100),
|
48
|
+
type varchar(255),
|
49
|
+
PRIMARY KEY (id)
|
50
|
+
);
|
51
|
+
SELECT setval('projects_id_seq', 100);
|
52
|
+
|
53
|
+
CREATE TABLE topics (
|
54
|
+
id serial,
|
55
|
+
title character varying(255),
|
56
|
+
author_name character varying(255),
|
57
|
+
author_email_address character varying(255),
|
58
|
+
written_on timestamp without time zone,
|
59
|
+
bonus_time time,
|
60
|
+
last_read date,
|
61
|
+
content text,
|
62
|
+
approved boolean default true,
|
63
|
+
replies_count integer default 0,
|
64
|
+
parent_id integer,
|
65
|
+
"type" character varying(50),
|
66
|
+
PRIMARY KEY (id)
|
67
|
+
);
|
68
|
+
SELECT setval('topics_id_seq', 100);
|
69
|
+
|
70
|
+
CREATE TABLE customers (
|
71
|
+
id serial,
|
72
|
+
name character varying,
|
73
|
+
balance integer default 0,
|
74
|
+
address_street character varying,
|
75
|
+
address_city character varying,
|
76
|
+
address_country character varying,
|
77
|
+
gps_location character varying,
|
78
|
+
PRIMARY KEY (id)
|
79
|
+
);
|
80
|
+
SELECT setval('customers_id_seq', 100);
|
81
|
+
|
82
|
+
CREATE TABLE orders (
|
83
|
+
id serial,
|
84
|
+
name character varying,
|
85
|
+
billing_customer_id integer,
|
86
|
+
shipping_customer_id integer,
|
87
|
+
PRIMARY KEY (id)
|
88
|
+
);
|
89
|
+
SELECT setval('orders_id_seq', 100);
|
90
|
+
|
91
|
+
CREATE TABLE movies (
|
92
|
+
movieid serial,
|
93
|
+
name text,
|
94
|
+
PRIMARY KEY (movieid)
|
95
|
+
);
|
96
|
+
|
97
|
+
CREATE TABLE subscribers (
|
98
|
+
nick text NOT NULL,
|
99
|
+
name text,
|
100
|
+
PRIMARY KEY (nick)
|
101
|
+
);
|
102
|
+
|
103
|
+
CREATE TABLE booleantests (
|
104
|
+
id serial,
|
105
|
+
value boolean,
|
106
|
+
PRIMARY KEY (id)
|
107
|
+
);
|
108
|
+
|
109
|
+
CREATE TABLE defaults (
|
110
|
+
id serial,
|
111
|
+
modified_date date default CURRENT_DATE,
|
112
|
+
modified_date_function date default now(),
|
113
|
+
fixed_date date default '2004-01-01',
|
114
|
+
modified_time timestamp default CURRENT_TIMESTAMP,
|
115
|
+
modified_time_function timestamp default now(),
|
116
|
+
fixed_time timestamp default '2004-01-01 00:00:00.000000-00',
|
117
|
+
char1 char(1) default 'Y',
|
118
|
+
char2 character varying(50) default 'a varchar field',
|
119
|
+
char3 text default 'a text field',
|
120
|
+
positive_integer integer default 1,
|
121
|
+
negative_integer integer default -1
|
122
|
+
);
|
123
|
+
|
124
|
+
CREATE TABLE auto_id_tests (
|
125
|
+
auto_id serial,
|
126
|
+
value integer,
|
127
|
+
PRIMARY KEY (auto_id)
|
128
|
+
);
|
129
|
+
|
130
|
+
CREATE TABLE entrants (
|
131
|
+
id serial,
|
132
|
+
name text,
|
133
|
+
course_id integer
|
134
|
+
);
|
135
|
+
|
136
|
+
CREATE TABLE colnametests (
|
137
|
+
id serial,
|
138
|
+
"references" integer NOT NULL
|
139
|
+
);
|
140
|
+
|
141
|
+
CREATE TABLE mixins (
|
142
|
+
id serial,
|
143
|
+
parent_id integer,
|
144
|
+
type character varying,
|
145
|
+
pos integer,
|
146
|
+
lft integer,
|
147
|
+
rgt integer,
|
148
|
+
root_id integer,
|
149
|
+
created_at timestamp,
|
150
|
+
updated_at timestamp,
|
151
|
+
PRIMARY KEY (id)
|
152
|
+
);
|
153
|
+
|
154
|
+
CREATE TABLE people (
|
155
|
+
id serial,
|
156
|
+
first_name text,
|
157
|
+
lock_version integer default 0,
|
158
|
+
PRIMARY KEY (id)
|
159
|
+
);
|
160
|
+
|
161
|
+
CREATE TABLE readers (
|
162
|
+
id serial,
|
163
|
+
post_id integer NOT NULL,
|
164
|
+
person_id integer NOT NULL,
|
165
|
+
primary key (id)
|
166
|
+
);
|
167
|
+
|
168
|
+
CREATE TABLE binaries (
|
169
|
+
id serial ,
|
170
|
+
data bytea,
|
171
|
+
PRIMARY KEY (id)
|
172
|
+
);
|
173
|
+
|
174
|
+
CREATE TABLE computers (
|
175
|
+
id serial,
|
176
|
+
developer integer NOT NULL,
|
177
|
+
"extendedWarranty" integer NOT NULL
|
178
|
+
);
|
179
|
+
|
180
|
+
CREATE TABLE posts (
|
181
|
+
id serial,
|
182
|
+
author_id integer,
|
183
|
+
title varchar(255),
|
184
|
+
type varchar(255),
|
185
|
+
body text
|
186
|
+
);
|
187
|
+
|
188
|
+
CREATE TABLE comments (
|
189
|
+
id serial,
|
190
|
+
post_id integer,
|
191
|
+
type varchar(255),
|
192
|
+
body text
|
193
|
+
);
|
194
|
+
|
195
|
+
CREATE TABLE authors (
|
196
|
+
id serial,
|
197
|
+
name varchar(255) default NULL
|
198
|
+
);
|
199
|
+
|
200
|
+
CREATE TABLE tasks (
|
201
|
+
id serial,
|
202
|
+
starting timestamp,
|
203
|
+
ending timestamp,
|
204
|
+
PRIMARY KEY (id)
|
205
|
+
);
|
206
|
+
|
207
|
+
CREATE TABLE categories (
|
208
|
+
id serial,
|
209
|
+
name varchar(255),
|
210
|
+
type varchar(255)
|
211
|
+
);
|
212
|
+
|
213
|
+
CREATE TABLE categories_posts (
|
214
|
+
category_id integer NOT NULL,
|
215
|
+
post_id integer NOT NULL
|
216
|
+
);
|
217
|
+
|
218
|
+
CREATE TABLE fk_test_has_pk (
|
219
|
+
id INTEGER NOT NULL PRIMARY KEY
|
220
|
+
);
|
221
|
+
|
222
|
+
CREATE TABLE fk_test_has_fk (
|
223
|
+
id INTEGER NOT NULL PRIMARY KEY,
|
224
|
+
fk_id INTEGER NOT NULL REFERENCES fk_test_has_fk(id)
|
225
|
+
);
|
226
|
+
|
227
|
+
CREATE TABLE geometrics (
|
228
|
+
id serial primary key,
|
229
|
+
a_point point,
|
230
|
+
-- a_line line, (the line type is currently not implemented in postgresql)
|
231
|
+
a_line_segment lseg,
|
232
|
+
a_box box,
|
233
|
+
a_path path,
|
234
|
+
a_polygon polygon,
|
235
|
+
a_circle circle
|
236
|
+
);
|
237
|
+
|
238
|
+
CREATE TABLE keyboards (
|
239
|
+
key_number serial primary key,
|
240
|
+
"name" character varying(50)
|
241
|
+
);
|
242
|
+
|
243
|
+
--Altered lock_version column name.
|
244
|
+
CREATE TABLE legacy_things (
|
245
|
+
id serial primary key,
|
246
|
+
tps_report_number integer,
|
247
|
+
version integer default 0
|
248
|
+
);
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: odbc-rails
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date:
|
6
|
+
version: "1.3"
|
7
|
+
date: 2007-01-09 00:00:00 +01:00
|
8
8
|
summary: ODBC Data Adapter for ActiveRecord.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -73,6 +73,10 @@ files:
|
|
73
73
|
- test/fixtures/db_definitions/oracle_odbc.sql
|
74
74
|
- test/fixtures/db_definitions/oracle_odbc2.drop.sql
|
75
75
|
- test/fixtures/db_definitions/oracle_odbc2.sql
|
76
|
+
- test/fixtures/db_definitions/postgresql.drop.sql
|
77
|
+
- test/fixtures/db_definitions/postgresql.sql
|
78
|
+
- test/fixtures/db_definitions/postgresql2.drop.sql
|
79
|
+
- test/fixtures/db_definitions/postgresql2.sql
|
76
80
|
- test/fixtures/db_definitions/progress.drop.sql
|
77
81
|
- test/fixtures/db_definitions/progress.sql
|
78
82
|
- test/fixtures/db_definitions/progress2.drop.sql
|