-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0978f25
commit 09d8423
Showing
10 changed files
with
103 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
# This file is loaded when running bin/console. | ||
|
||
Simple::SQL.exec <<~SQL | ||
CREATE SCHEMA IF NOT EXISTS store; | ||
CREATE TABLE IF NOT EXISTS store.organizations ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR | ||
); | ||
CREATE TABLE IF NOT EXISTS store.users ( | ||
id SERIAL PRIMARY KEY, | ||
organization_id INTEGER REFERENCES store.organizations (id), | ||
role_id INTEGER, | ||
first_name VARCHAR, | ||
last_name VARCHAR, | ||
metadata JSONB, | ||
created_at timestamp, | ||
updated_at timestamp | ||
); | ||
SQL | ||
|
||
Simple::Store.ask "DELETE FROM store.users" | ||
Simple::Store.ask "DELETE FROM store.organizations" | ||
|
||
Simple::Store::Metamodel.register "User", table_name: "store.users" | ||
# do |registration| | ||
# attribute :last_name | ||
# end | ||
|
||
Simple::Store::Metamodel.register "Organization", table_name: "store.organizations" do | ||
attribute :city, writable: false | ||
end | ||
|
||
user = Simple::Store.create! "User", first_name: "foo" | ||
p user |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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