rails_sql_views4 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_sql_views4/connection_adapters/abstract/schema_statements.rb +12 -1
- data/lib/rails_sql_views4/connection_adapters/postgresql_adapter.rb +12 -1
- data/lib/rails_sql_views4/version.rb +1 -1
- data/test/adapter_test.rb +1 -0
- data/test/dummy/config/database.yml +8 -5
- data/test/dummy/db/schema.rb +3 -0
- data/test/dummy/log/development.log +245 -0
- data/test/dummy/log/test.log +4960 -0
- data/test/schema.native_postgresql.out.rb +16 -21
- data/test/test_helper.rb +12 -1
- data/test/view_model_test.rb +2 -0
- metadata +6 -7
- data/test/dummy/db/development.sqlite3 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c02f5c00bad55e5de74007d32ed14aa3aa8bb5a
|
4
|
+
data.tar.gz: 9a78a4c88903c846afb96a3a15a3cb19c3652be9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 435ff55234b6fbe9ae0bde92c0e414e5cd1eb2ba12b39439eb5832048beed7bedcd5fb5e17218b9dff6ffbcbda0c7b1d1312b23decd4aba5ea15211e2c9c22ca
|
7
|
+
data.tar.gz: eee216b8a5db4c4e073bf05289f72fb0552f53716c59f29d2e6c0aa8f7bfa21cfb8f2febc560202cf92abac5af200013675170737cba0b369631a172fbc26c6e
|
@@ -10,6 +10,14 @@ module RailsSqlViews4
|
|
10
10
|
# [<tt>:check_option</tt>]
|
11
11
|
# Specify restrictions for inserts or updates in updatable views. ANSI SQL 92 defines two check option
|
12
12
|
# values: CASCADED and LOCAL. See your database documentation for allowed values.
|
13
|
+
#
|
14
|
+
#
|
15
|
+
# we have a problem with the force option in postgres
|
16
|
+
# rescue nil will rescue the ruby program, but we still have an error for postgres
|
17
|
+
# and unfortunatly for postgress, the first error will stop the interpretor :
|
18
|
+
# ActiveRecord::StatementInvalid Exception: PG::InFailedSqlTransaction: ERROR:
|
19
|
+
# current transaction is aborted, commands ignored until end of transaction block
|
20
|
+
#
|
13
21
|
def create_view(name, select_query, options={})
|
14
22
|
if supports_views?
|
15
23
|
view_definition = ViewDefinition.new(self, select_query)
|
@@ -19,6 +27,7 @@ module RailsSqlViews4
|
|
19
27
|
end
|
20
28
|
|
21
29
|
if options[:force]
|
30
|
+
puts" TOTO : Please, force option is not correctly implemented in postgres"
|
22
31
|
drop_view(name) rescue nil
|
23
32
|
end
|
24
33
|
|
@@ -31,6 +40,7 @@ module RailsSqlViews4
|
|
31
40
|
end
|
32
41
|
create_sql << "AS #{view_definition.select_query}"
|
33
42
|
create_sql << " WITH #{options[:check_option]} CHECK OPTION" if options[:check_option]
|
43
|
+
debugger;
|
34
44
|
execute create_sql
|
35
45
|
end
|
36
46
|
end
|
@@ -74,7 +84,8 @@ module RailsSqlViews4
|
|
74
84
|
# Specify the drop behavior. ANSI SQL 92 defines two drop behaviors, CASCADE and RESTRICT. See your
|
75
85
|
# database documentation to determine what drop behaviors are available.
|
76
86
|
def drop_view(name, options={})
|
77
|
-
if supports_views?
|
87
|
+
# if supports_views? # because of postgres (see create_view with force option)
|
88
|
+
if supports_views? & table_exists?(name)
|
78
89
|
drop_sql = "DROP VIEW #{quote_table_name(name)}"
|
79
90
|
drop_sql << " #{options[:drop_behavior]}" if options[:drop_behavior]
|
80
91
|
execute drop_sql
|
@@ -20,6 +20,17 @@ module RailsSqlViews4
|
|
20
20
|
query(q, name).map { |row| row[0] }
|
21
21
|
end
|
22
22
|
|
23
|
+
def tables(name = nil) #:nodoc:
|
24
|
+
q = <<-SQL
|
25
|
+
SELECT table_name, table_type
|
26
|
+
FROM information_schema.tables
|
27
|
+
WHERE table_schema IN (#{schemas})
|
28
|
+
AND table_type = 'TABLE'
|
29
|
+
SQL
|
30
|
+
|
31
|
+
query(q, name).map { |row| row[0] }
|
32
|
+
end
|
33
|
+
|
23
34
|
def base_tables(name = nil)
|
24
35
|
q = <<-SQL
|
25
36
|
SELECT table_name, table_type
|
@@ -55,7 +66,7 @@ module RailsSqlViews4
|
|
55
66
|
# TODO
|
56
67
|
# puts in postgres adapter ??? not in SQLITE ?
|
57
68
|
# select_value(q, name) or raise "No view called #{view} found"
|
58
|
-
select_value(q, name).gsub("CREATE VIEW #{view} AS ", "")
|
69
|
+
select_value(q, name).gsub("CREATE VIEW #{view} AS ", "") or raise "No view called #{view} found"
|
59
70
|
|
60
71
|
end
|
61
72
|
|
data/test/adapter_test.rb
CHANGED
@@ -5,20 +5,23 @@
|
|
5
5
|
# gem 'sqlite3'
|
6
6
|
#
|
7
7
|
default: &default
|
8
|
-
adapter:
|
8
|
+
adapter: postgresql
|
9
9
|
pool: 5
|
10
10
|
timeout: 5000
|
11
11
|
|
12
12
|
development:
|
13
|
-
|
14
|
-
|
13
|
+
adapter: postgresql
|
14
|
+
encoding: unicode
|
15
|
+
database: rails_sql_views4_development
|
16
|
+
|
15
17
|
|
16
18
|
# Warning: The database defined as "test" will be erased and
|
17
19
|
# re-generated from your development database when you run "rake".
|
18
20
|
# Do not set this db to the same as development or production.
|
19
21
|
test:
|
20
|
-
|
21
|
-
|
22
|
+
adapter: postgresql
|
23
|
+
encoding: unicode
|
24
|
+
database: rails_sql_views_unittest
|
22
25
|
|
23
26
|
production:
|
24
27
|
<<: *default
|
data/test/dummy/db/schema.rb
CHANGED
@@ -13,6 +13,9 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20141228200440) do
|
15
15
|
|
16
|
+
# These are extensions that must be enabled in order to support this database
|
17
|
+
enable_extension "plpgsql"
|
18
|
+
|
16
19
|
create_table "items", force: true do |t|
|
17
20
|
t.integer "person_id"
|
18
21
|
t.datetime "created_at"
|
@@ -437,3 +437,248 @@ SQLite3::SQLException: no such view: v_people: DROP VIEW "v_people"
|
|
437
437
|
[1m[36m (0.8ms)[0m [1mDROP VIEW "v_people"[0m
|
438
438
|
[1m[35m (0.9ms)[0m CREATE VIEW "v_people" AS select id, first_name, last_name, ssn, address_id from people
|
439
439
|
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
440
|
+
[1m[36m (3.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
441
|
+
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
442
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
443
|
+
Migrating to CreatePeople (20141228200436)
|
444
|
+
[1m[35m (0.1ms)[0m BEGIN
|
445
|
+
[1m[36m (3.1ms)[0m [1mCREATE TABLE "people" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "address_id" integer) [0m
|
446
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200436"]]
|
447
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
448
|
+
Migrating to CreatePeople2 (20141228200437)
|
449
|
+
[1m[35m (0.3ms)[0m BEGIN
|
450
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200437_create_people2.rb:8)
|
451
|
+
[1m[36m (3.1ms)[0m [1mCREATE TABLE "people2" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
452
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200437"]]
|
453
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
454
|
+
Migrating to CreatePlaces (20141228200438)
|
455
|
+
[1m[35m (0.2ms)[0m BEGIN
|
456
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200438_create_places.rb:9)
|
457
|
+
[1m[36m (3.3ms)[0m [1mCREATE TABLE "places" ("id" serial primary key, "address" text, "city" character varying, "cstate" character varying, "country" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
458
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200438"]]
|
459
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
460
|
+
Migrating to CreateItems (20141228200439)
|
461
|
+
[1m[35m (0.2ms)[0m BEGIN
|
462
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200439_create_items.rb:5)
|
463
|
+
[1m[36m (1.6ms)[0m [1mCREATE TABLE "items" ("id" serial primary key, "person_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
464
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200439"]]
|
465
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
466
|
+
Migrating to CreateItemsPeople (20141228200440)
|
467
|
+
[1m[35m (0.2ms)[0m BEGIN
|
468
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200440_create_items_people.rb:6)
|
469
|
+
[1m[36m (2.2ms)[0m [1mCREATE TABLE "items_people" ("id" serial primary key, "person_id" integer, "item_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
470
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200440"]]
|
471
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
472
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
473
|
+
[1m[36m (2.5ms)[0m [1m SELECT table_name, table_type
|
474
|
+
FROM information_schema.tables
|
475
|
+
WHERE table_schema IN ('"$user"','public')
|
476
|
+
AND table_type = 'BASE TABLE'
|
477
|
+
[0m
|
478
|
+
[1m[35m (0.7ms)[0m SELECT table_name, table_type
|
479
|
+
FROM information_schema.tables
|
480
|
+
WHERE table_schema IN ('"$user"','public')
|
481
|
+
AND table_type = 'VIEW'
|
482
|
+
|
483
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
484
|
+
[1m[35m (0.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
485
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
486
|
+
Migrating to CreatePeople (20141228200436)
|
487
|
+
[1m[35m (0.1ms)[0m BEGIN
|
488
|
+
[1m[36m (3.0ms)[0m [1mCREATE TABLE "people" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "address_id" integer) [0m
|
489
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200436"]]
|
490
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
491
|
+
Migrating to CreatePeople2 (20141228200437)
|
492
|
+
[1m[35m (0.3ms)[0m BEGIN
|
493
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200437_create_people2.rb:8)
|
494
|
+
[1m[36m (2.2ms)[0m [1mCREATE TABLE "people2" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
495
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200437"]]
|
496
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
497
|
+
Migrating to CreatePlaces (20141228200438)
|
498
|
+
[1m[35m (0.2ms)[0m BEGIN
|
499
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200438_create_places.rb:9)
|
500
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "places" ("id" serial primary key, "address" text, "city" character varying, "cstate" character varying, "country" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
501
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200438"]]
|
502
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
503
|
+
Migrating to CreateItems (20141228200439)
|
504
|
+
[1m[35m (0.3ms)[0m BEGIN
|
505
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200439_create_items.rb:5)
|
506
|
+
[1m[36m (2.9ms)[0m [1mCREATE TABLE "items" ("id" serial primary key, "person_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
507
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200439"]]
|
508
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
509
|
+
Migrating to CreateItemsPeople (20141228200440)
|
510
|
+
[1m[35m (0.2ms)[0m BEGIN
|
511
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200440_create_items_people.rb:6)
|
512
|
+
[1m[36m (1.7ms)[0m [1mCREATE TABLE "items_people" ("id" serial primary key, "person_id" integer, "item_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
513
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200440"]]
|
514
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
515
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
516
|
+
[1m[36m (2.6ms)[0m [1m SELECT table_name, table_type
|
517
|
+
FROM information_schema.tables
|
518
|
+
WHERE table_schema IN ('"$user"','public')
|
519
|
+
AND table_type = 'BASE TABLE'
|
520
|
+
[0m
|
521
|
+
[1m[35m (0.6ms)[0m SELECT table_name, table_type
|
522
|
+
FROM information_schema.tables
|
523
|
+
WHERE table_schema IN ('"$user"','public')
|
524
|
+
AND table_type = 'VIEW'
|
525
|
+
|
526
|
+
[1m[36m (2.8ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
527
|
+
[1m[35m (1.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
528
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
529
|
+
Migrating to CreatePeople (20141228200436)
|
530
|
+
[1m[35m (0.1ms)[0m BEGIN
|
531
|
+
[1m[36m (2.7ms)[0m [1mCREATE TABLE "people" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "address_id" integer) [0m
|
532
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200436"]]
|
533
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
534
|
+
Migrating to CreatePeople2 (20141228200437)
|
535
|
+
[1m[35m (0.2ms)[0m BEGIN
|
536
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200437_create_people2.rb:8)
|
537
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "people2" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
538
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200437"]]
|
539
|
+
[1m[36m (1.3ms)[0m [1mCOMMIT[0m
|
540
|
+
Migrating to CreatePlaces (20141228200438)
|
541
|
+
[1m[35m (0.2ms)[0m BEGIN
|
542
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200438_create_places.rb:9)
|
543
|
+
[1m[36m (2.1ms)[0m [1mCREATE TABLE "places" ("id" serial primary key, "address" text, "city" character varying, "cstate" character varying, "country" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
544
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200438"]]
|
545
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
546
|
+
Migrating to CreateItems (20141228200439)
|
547
|
+
[1m[35m (0.3ms)[0m BEGIN
|
548
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200439_create_items.rb:5)
|
549
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "items" ("id" serial primary key, "person_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
550
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200439"]]
|
551
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
552
|
+
Migrating to CreateItemsPeople (20141228200440)
|
553
|
+
[1m[35m (0.2ms)[0m BEGIN
|
554
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200440_create_items_people.rb:6)
|
555
|
+
[1m[36m (1.5ms)[0m [1mCREATE TABLE "items_people" ("id" serial primary key, "person_id" integer, "item_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
556
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200440"]]
|
557
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
558
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
559
|
+
[1m[36m (3.4ms)[0m [1m SELECT table_name, table_type
|
560
|
+
FROM information_schema.tables
|
561
|
+
WHERE table_schema IN ('"$user"','public')
|
562
|
+
AND table_type = 'BASE TABLE'
|
563
|
+
[0m
|
564
|
+
[1m[35m (0.7ms)[0m SELECT table_name, table_type
|
565
|
+
FROM information_schema.tables
|
566
|
+
WHERE table_schema IN ('"$user"','public')
|
567
|
+
AND table_type = 'VIEW'
|
568
|
+
|
569
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
570
|
+
[1m[35m (0.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
571
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
572
|
+
Migrating to CreatePeople (20141228200436)
|
573
|
+
[1m[35m (0.1ms)[0m BEGIN
|
574
|
+
[1m[36m (3.1ms)[0m [1mCREATE TABLE "people" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "address_id" integer) [0m
|
575
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200436"]]
|
576
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
577
|
+
Migrating to CreatePeople2 (20141228200437)
|
578
|
+
[1m[35m (0.3ms)[0m BEGIN
|
579
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200437_create_people2.rb:8)
|
580
|
+
[1m[36m (2.4ms)[0m [1mCREATE TABLE "people2" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
581
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200437"]]
|
582
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
583
|
+
Migrating to CreatePlaces (20141228200438)
|
584
|
+
[1m[35m (0.5ms)[0m BEGIN
|
585
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200438_create_places.rb:9)
|
586
|
+
[1m[36m (2.6ms)[0m [1mCREATE TABLE "places" ("id" serial primary key, "address" text, "city" character varying, "cstate" character varying, "country" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
587
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200438"]]
|
588
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
589
|
+
Migrating to CreateItems (20141228200439)
|
590
|
+
[1m[35m (0.3ms)[0m BEGIN
|
591
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200439_create_items.rb:5)
|
592
|
+
[1m[36m (2.1ms)[0m [1mCREATE TABLE "items" ("id" serial primary key, "person_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
593
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200439"]]
|
594
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
595
|
+
Migrating to CreateItemsPeople (20141228200440)
|
596
|
+
[1m[35m (0.2ms)[0m BEGIN
|
597
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200440_create_items_people.rb:6)
|
598
|
+
[1m[36m (1.5ms)[0m [1mCREATE TABLE "items_people" ("id" serial primary key, "person_id" integer, "item_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
599
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200440"]]
|
600
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
601
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
602
|
+
[1m[36m (2.7ms)[0m [1m SELECT table_name, table_type
|
603
|
+
FROM information_schema.tables
|
604
|
+
WHERE table_schema IN ('"$user"','public')
|
605
|
+
AND table_type = 'BASE TABLE'
|
606
|
+
[0m
|
607
|
+
[1m[35m (0.7ms)[0m SELECT table_name, table_type
|
608
|
+
FROM information_schema.tables
|
609
|
+
WHERE table_schema IN ('"$user"','public')
|
610
|
+
AND table_type = 'VIEW'
|
611
|
+
|
612
|
+
[1m[36m (16.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying NOT NULL) [0m
|
613
|
+
[1m[35m (1.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
614
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
615
|
+
Migrating to CreatePeople (20141228200436)
|
616
|
+
[1m[35m (0.1ms)[0m BEGIN
|
617
|
+
[1m[36m (2.9ms)[0m [1mCREATE TABLE "people" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "address_id" integer) [0m
|
618
|
+
[1m[35mSQL (0.6ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200436"]]
|
619
|
+
[1m[36m (0.8ms)[0m [1mCOMMIT[0m
|
620
|
+
Migrating to CreatePeople2 (20141228200437)
|
621
|
+
[1m[35m (0.3ms)[0m BEGIN
|
622
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200437_create_people2.rb:8)
|
623
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "people2" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "ssn" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
624
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200437"]]
|
625
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
626
|
+
Migrating to CreatePlaces (20141228200438)
|
627
|
+
[1m[35m (0.2ms)[0m BEGIN
|
628
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200438_create_places.rb:9)
|
629
|
+
[1m[36m (2.5ms)[0m [1mCREATE TABLE "places" ("id" serial primary key, "address" text, "city" character varying, "cstate" character varying, "country" character varying, "created_at" timestamp, "updated_at" timestamp) [0m
|
630
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200438"]]
|
631
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
632
|
+
Migrating to CreateItems (20141228200439)
|
633
|
+
[1m[35m (0.3ms)[0m BEGIN
|
634
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200439_create_items.rb:5)
|
635
|
+
[1m[36m (2.0ms)[0m [1mCREATE TABLE "items" ("id" serial primary key, "person_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
636
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200439"]]
|
637
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
638
|
+
Migrating to CreateItemsPeople (20141228200440)
|
639
|
+
[1m[35m (0.3ms)[0m BEGIN
|
640
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/laurent/Desktop/code/rails_sql_views4/test/dummy/db/migrate/20141228200440_create_items_people.rb:6)
|
641
|
+
[1m[36m (2.2ms)[0m [1mCREATE TABLE "items_people" ("id" serial primary key, "person_id" integer, "item_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
642
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141228200440"]]
|
643
|
+
[1m[36m (0.3ms)[0m [1mCOMMIT[0m
|
644
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
645
|
+
[1m[36m (5.5ms)[0m [1m SELECT table_name, table_type
|
646
|
+
FROM information_schema.tables
|
647
|
+
WHERE table_schema IN ('"$user"','public')
|
648
|
+
AND table_type = 'BASE TABLE'
|
649
|
+
[0m
|
650
|
+
[1m[35m (0.8ms)[0m SELECT table_name, table_type
|
651
|
+
FROM information_schema.tables
|
652
|
+
WHERE table_schema IN ('"$user"','public')
|
653
|
+
AND table_type = 'VIEW'
|
654
|
+
|
655
|
+
[1m[36m (0.3ms)[0m [1mDROP VIEW "v_people"[0m
|
656
|
+
PG::UndefinedTable: ERROR: view "v_people" does not exist
|
657
|
+
: DROP VIEW "v_people"
|
658
|
+
[1m[35m (2.4ms)[0m CREATE VIEW "v_people" AS select first_name, last_name, ssn from people
|
659
|
+
[1m[36m (4.2ms)[0m [1m SELECT table_name, table_type
|
660
|
+
FROM information_schema.tables
|
661
|
+
WHERE table_schema IN ('"$user"','public')
|
662
|
+
AND table_type IN ('BASE TABLE', 'VIEW')
|
663
|
+
[0m
|
664
|
+
[1m[36mPerson Load (0.5ms)[0m [1mSELECT "people".* FROM "people"[0m
|
665
|
+
[1m[35m (4.0ms)[0m SELECT table_name, table_type
|
666
|
+
FROM information_schema.tables
|
667
|
+
WHERE table_schema IN ('"$user"','public')
|
668
|
+
AND table_type IN ('BASE TABLE', 'VIEW')
|
669
|
+
|
670
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
671
|
+
[1m[35mSQL (0.7ms)[0m INSERT INTO "people" ("first_name", "last_name") VALUES ($1, $2) RETURNING "id" [["first_name", "Laurent"], ["last_name", "Buffat"]]
|
672
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
673
|
+
[1m[35m (0.2ms)[0m BEGIN
|
674
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "people" ("last_name", "first_name") VALUES ($1, $2) RETURNING "id"[0m [["last_name", "Villemagne"], ["first_name", "Genevieve"]]
|
675
|
+
[1m[35m (1.0ms)[0m COMMIT
|
676
|
+
[1m[36mPerson Load (0.4ms)[0m [1mSELECT "people".* FROM "people"[0m
|
677
|
+
[1m[36m (2.2ms)[0m [1m SELECT table_name, table_type
|
678
|
+
FROM information_schema.tables
|
679
|
+
WHERE table_schema IN ('"$user"','public')
|
680
|
+
AND table_type IN ('BASE TABLE', 'VIEW')
|
681
|
+
[0m
|
682
|
+
[1m[35mPerson Load (0.7ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|
683
|
+
[1m[36mVPerson Load (0.9ms)[0m [1mSELECT "v_people".* FROM "v_people" LIMIT 1[0m
|
684
|
+
[1m[35mPerson Load (0.5ms)[0m SELECT "people".* FROM "people" ORDER BY "people"."id" ASC LIMIT 1
|