Last active
September 3, 2017 13:16
-
-
Save sajithdilshan/6e59c33f594e921b930ab5d5028cffac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Test.Repo.Migrations.SampleMigration do | |
use Ecto.Migration | |
def change do | |
create table(:TEST_TENANTS, primary_key: false) do | |
add :ID, :serial, primary_key: true | |
add :NAME, :string | |
end | |
create table(:TEST_GROUPS, primary_key: false) do | |
add :ID, :serial, primary_key: true | |
add :TENANT_ID, references(:TEST_TENANTS, column: :ID) | |
add :NAME, :string | |
end | |
create table(:TEST_USERS, primary_key: false) do | |
add :ID, :serial, primary_key: true | |
add :TENANT_ID, references(:TEST_TENANTS, column: :ID) | |
add :NAME, :string | |
end | |
create table(:TEST_GROUPS_USERS, primary_key: false) do | |
add :GROUP_ID, references(:TEST_GROUPS, column: :ID) | |
add :USER_ID, references(:TEST_USERS, column: :ID) | |
end | |
create table(:TEST_PERMISSIONS, primary_key: false) do | |
add :ID, :serial, primary_key: true | |
add :GROUP_ID, references(:TEST_GROUPS, column: :ID) | |
add :NAME, :string | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment