Packages
ecto_sql
3.0.0-rc.1
3.14.0
3.13.5
3.13.4
3.13.3
3.13.2
3.13.1
3.13.0
3.12.1
3.12.0
3.11.3
3.11.2
3.11.1
3.11.0
3.10.2
3.10.1
3.10.0
3.9.2
3.9.1
3.9.0
3.8.3
3.8.2
3.8.1
3.8.0
3.7.2
3.7.1
3.7.0
3.6.2
3.6.1
3.6.0
3.5.4
3.5.3
3.5.2
3.5.1
3.5.0
3.5.0-rc.1
3.5.0-rc.0
3.4.5
3.4.4
3.4.3
3.4.2
3.4.1
3.4.0
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.2
3.2.1
3.2.0
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
3.0.0-rc.1
3.0.0-rc.0
SQL-based adapters for Ecto and database migrations
Current section
Files
Jump to
Current section
Files
integration_test/support/migration.exs
defmodule Ecto.Integration.Migration do
use Ecto.Migration
def change do
create table(:users, comment: "users table") do
add :name, :text, comment: "name column"
add :custom_id, :uuid
timestamps()
end
create table(:posts) do
add :title, :string, size: 100
add :counter, :integer
add :text, :binary
add :bid, :binary_id
add :uuid, :uuid
add :meta, :map
add :links, {:map, :string}
add :intensities, {:map, :float}
add :public, :boolean
add :cost, :decimal, precision: 2, scale: 1
add :visits, :integer
add :intensity, :float
add :author_id, :integer
add :posted, :date
timestamps(null: true)
end
create table(:posts_users, primary_key: false) do
add :post_id, references(:posts)
add :user_id, references(:users)
end
create table(:posts_users_pk) do
add :post_id, references(:posts)
add :user_id, references(:users)
timestamps()
end
# Add a unique index on uuid. We use this
# to verify the behaviour that the index
# only matters if the UUID column is not NULL.
create unique_index(:posts, [:uuid], comment: "posts index")
create table(:permalinks) do
add :uniform_resource_locator, :string
add :post_id, references(:posts)
add :user_id, references(:users)
end
create unique_index(:permalinks, [:uniform_resource_locator])
create table(:comments) do
add :text, :string, size: 100
add :lock_version, :integer, default: 1
add :post_id, references(:posts)
add :author_id, references(:users)
end
create table(:customs, primary_key: false) do
add :bid, :binary_id, primary_key: true
add :uuid, :uuid
end
create unique_index(:customs, [:uuid])
create table(:customs_customs, primary_key: false) do
add :custom_id1, references(:customs, column: :bid, type: :binary_id)
add :custom_id2, references(:customs, column: :bid, type: :binary_id)
end
create table(:barebones) do
add :num, :integer
end
create table(:transactions) do
add :num, :integer
end
create table(:lock_counters) do
add :count, :integer
end
create table(:orders) do
add :item, :map
add :comment_id, references(:comments)
end
unless :array_type in ExUnit.configuration[:exclude] do
create table(:tags) do
add :ints, {:array, :integer}
add :uuids, {:array, :uuid}, default: []
add :items, {:array, :map}
end
end
create table(:composite_pk, primary_key: false) do
add :a, :integer, primary_key: true
add :b, :integer, primary_key: true
add :name, :string
end
create table(:corrupted_pk, primary_key: false) do
add :a, :string
end
create table(:posts_users_composite_pk) do
add :post_id, references(:posts), primary_key: true
add :user_id, references(:users), primary_key: true
timestamps()
end
create unique_index(:posts_users_composite_pk, [:post_id, :user_id])
create table(:usecs) do
add :naive_datetime_usec, :naive_datetime_usec
add :utc_datetime_usec, :utc_datetime_usec
end
end
end