@@ -43,9 +43,12 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
4343 { :create , table ( :posts , prefix: :foo ) ,
4444 [ { :add , :category_0 , % Reference { table: :categories } , [ ] } ] }
4545
46- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
47- execute_ddl ( create )
48- end
46+ assert execute_ddl ( create ) == [
47+ """
48+ CREATE TABLE foo.posts ("category_0" INTEGER CONSTRAINT "posts_category_0_fkey" REFERENCES foo.categories("id"))
49+ """
50+ |> remove_newlines
51+ ]
4952 end
5053
5154 test "create table with references" do
@@ -295,10 +298,7 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
295298
296299 test "drop table with prefix" do
297300 drop = { :drop , table ( :posts , prefix: :foo ) }
298-
299- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
300- execute_ddl ( drop )
301- end
301+ assert execute_ddl ( drop ) == [ ~s| DROP TABLE foo.posts| ]
302302 end
303303
304304 test "alter table" do
@@ -328,9 +328,9 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
328328 { :alter , table ( :posts , prefix: :foo ) ,
329329 [ { :add , :author_id , % Reference { table: :author } , [ ] } ] }
330330
331- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
332- execute_ddl ( alter )
333- end
331+ assert execute_ddl ( alter ) == [
332+ ~s | ALTER TABLE foo.posts ADD COLUMN "author_id" INTEGER CONSTRAINT "posts_author_id_fkey" REFERENCES foo.author("id") |
333+ ]
334334 end
335335
336336 test "alter table with serial primary key" do
@@ -374,16 +374,16 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
374374 test "create index with prefix" do
375375 create = { :create , index ( :posts , [ :category_id , :permalink ] , prefix: :foo ) }
376376
377- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
378- execute_ddl ( create )
379- end
377+ assert execute_ddl ( create ) == [
378+ ~s | CREATE INDEX "posts_category_id_permalink_index" ON foo.posts ("category_id", "permalink") |
379+ ]
380380
381381 create =
382382 { :create , index ( :posts , [ "lower(permalink)" ] , name: "posts$main" , prefix: :foo ) }
383383
384- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
385- execute_ddl ( create )
386- end
384+ assert execute_ddl ( create ) == [
385+ ~s | CREATE INDEX "posts$main" ON foo.posts (lower(permalink)) |
386+ ]
387387 end
388388
389389 test "create index with comment" do
@@ -470,10 +470,7 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
470470
471471 test "drop index with prefix" do
472472 drop = { :drop , index ( :posts , [ :id ] , name: "posts$main" , prefix: :foo ) , :restrict }
473-
474- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
475- execute_ddl ( drop )
476- end
473+ assert execute_ddl ( drop ) == [ ~s| DROP INDEX foo.posts$main| ]
477474 end
478475
479476 test "drop index concurrently not supported" do
@@ -516,10 +513,7 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
516513
517514 test "rename table with prefix" do
518515 rename = { :rename , table ( :posts , prefix: :foo ) , table ( :new_posts , prefix: :foo ) }
519-
520- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
521- execute_ddl ( rename )
522- end
516+ assert execute_ddl ( rename ) == [ ~s| ALTER TABLE foo.posts RENAME TO "new_posts"| ]
523517 end
524518
525519 test "rename column" do
@@ -533,9 +527,9 @@ defmodule Ecto.Adapters.SQLite3.Connection.MigrationTest do
533527 test "rename column in prefixed table" do
534528 rename = { :rename , table ( :posts , prefix: :foo ) , :given_name , :first_name }
535529
536- assert_raise ArgumentError , "SQLite3 does not support table prefixes" , fn ->
537- execute_ddl ( rename )
538- end
530+ assert execute_ddl ( rename ) == [
531+ ~s | ALTER TABLE foo.posts RENAME COLUMN "given_name" TO "first_name" |
532+ ]
539533 end
540534
541535 test "autoincrement support" do
0 commit comments