Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SchemaPlus
Search
Michał Łomnicki
November 21, 2012
Technology
50
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SchemaPlus
Michał Łomnicki
November 21, 2012
More Decks by Michał Łomnicki
See All by Michał Łomnicki
DDD, Rails and persistence
mlomnicki
1
280
Forget Ruby. Forget CoffeeScript. Do SOA
mlomnicki
1
130
Having fun with legacy apps
mlomnicki
1
81
CAP Theorem
mlomnicki
2
140
[PL] Transakcje w bazach danych
mlomnicki
1
300
Ruby Tricks 2
mlomnicki
3
83
Other Decks in Technology
See All in Technology
「面白い!」を信じ抜け。激動の時代を貫く、オンリーワン・エンジニアの条件
kizawa2020
2
590
Hub & Spoke 環境のネットワークルーティングを分解してみる
tsuyataku
1
490
markdown-poster Introduction
kazamori
0
450
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.3k
tamachi.goを支える技術
rymiyamoto
0
130
Digitization部 紹介資料
sansan33
PRO
2
7.8k
ClaudeCodeでセキュリティ監視業務を半自動化_1年の運用でわかったAIに任せる設計の5つのポイント
kintotechdev
4
1k
サービス内で複数のOP・ASを連鎖させる(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
430
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
130
AI時代の「OAuth認証」にどう物申すか?(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
430
AIレビュー時代に必要なのは、SLOで引く撤退ライン
nobuoooo
0
160
【Oracle AI Spotlight ウェビナー】AWSか、Azureか、Google Cloudか。その議論にオラクルを含める意義。
oracle4engineer
PRO
1
160
Featured
See All Featured
Docker and Python
trallard
47
4.2k
Darren the Foodie - Storyboard
khoart
PRO
3
3.8k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
510
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
370
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
490
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
180
The untapped power of vector embeddings
frankvandijk
2
1.8k
エンジニアに許された特別な時間の終わり
watany
108
250k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Documentation Writing (for coders)
carmenintech
77
5.5k
Transcript
SchemaPlus enhanced capabilities for schema definition and querying Ronen Barzel
& Michał Łomnicki
History Simon Harris / harukizaemon redhillonrails_core (2006, 2009) foreign_key_migrations =>
automatic_foreign_key schema_plus (2011)
Goals solid base well-tested well-documented better name :)
Plain ActiveRecord create_table :comments do |t| t.text :body t.integer :post_id
t.integer :author_id end execute "ALTER TABLE comments ADD FOREIGN KEY (post_id) \ REFERENCES (posts)" execute "ALTER TABLE comments ADD FOREIGN KEY (author_id) \ REFERENCES (users)" add_index :comments, :post_id
With schema_plus create_table :comments do |t| t.text :body t.integer :post_id,
:index => true t.integer :author_id, :references => :users end
auto-index foreign keys # without auto_index t.integer :post_id, :index =>
true # with auto_index t.integer :post_id
index t.string :area_code t.string :local_number, :index => { :unique =>
true, :with => :area_code }
Other features global, per table and per statement config expressional
indexes views
SchemaAssociations # without schema_associations class Post < ActiveRecord::Base belongs_to :author
has_many :comments end
SchemaAssociations # without schema_associations class Post < ActiveRecord::Base # associations
auto-created from foreign keys end
SchemaValidations create_table :posts do |t| t.integer :author_id, :null => false,
:references => :users t.integer :likes_count t.string :content, :limit => 5_000 end
SchemaValidations # without schema_validations class Post < ActiveRecord::Base validates :author,
:presence => true validates :likes_count, :numericality => true validates :content, :length => { :maximum => 5_000 } end
SchemaValidations # with schema_validations class Post < ActiveRecord::Base end
Schema Family Scary? ...but that's next step for active record
pattern
Questions http://github.com/lomba