polywiki/db/migrations/20211017102953559_create_ac...

26 lines
579 B
Crystal

class CreateAcls < Jennifer::Migration::Base
def up
create_table :acls do |t|
t.uuid :id, {:primary => true}
t.string :role, {:null => false}
t.string :path, {:null => false}
t.string :permission, {:null => false}
t.timestamp :created_at, {:null => false}
t.timestamp :updated_at, {:null => false}
end
change_table :acls do |t|
t.add_index [:role, :path], type: :uniq
end
end
def down
change_table :acls do |t|
t.drop_index [:role, :path]
end
drop_table :acls if table_exists? :acls
end
end