nyamadori / rails-mysql-mongo-weblog Goto Github PK
View Code? Open in Web Editor NEWA weblog made by Rails 4.2 + MySQL + MongoDB
A weblog made by Rails 4.2 + MySQL + MongoDB
mongoの取り扱いをActiveRecode準拠にする
データベース設計: #1
型 | 属性名 | 役割 |
---|---|---|
ObjectID | _id | コンテンツを一意に特定する ID |
int | type | コンテンツの種類 |
string | body | コンテンツ文字列 |
MongoDB のドキュメントを呼ぶための重複コードが増えてきており、今後も増える見込があるためリファクタリングの必要あり。
データベース設計: #1
MySQL テーブル
型 | 属性名 | 役割 |
---|---|---|
int | id | 記事を一意に特定する ID |
string | title_oid | タイトル本体を特定する MongoDB の ObjectID |
string | body_oid | 記事本文を特定する MongoDB の ObjectID |
int | category_id | 所属カテゴリを特定するための categories テーブルへの ID |
datetime | published_at | 投稿日時 |
テーブル名や属性名の規則は基本的に Rails の規則を踏襲する。
MySQL から MongoDB のデータを参照するための属性の名前には _oid
を末尾に付与する。
型 | 属性名 | 役割 |
---|---|---|
int | id | 記事を一意に特定する ID |
string | title_oid | タイトル本体を特定する MongoDB の ObjectID |
string | body_oid | 記事本文を特定する MongoDB の ObjectID |
int | category_id | 所属カテゴリを特定するための categories テーブルへの ID |
datetime | published_at | 投稿日時 |
型 | 属性名 | 役割 |
---|---|---|
int | id | カテゴリを一意に特定する ID |
string | name | カテゴリ名 |
型 | 属性名 | 役割 |
---|---|---|
ObjectID | _id | タイトルを一意に特定する ID |
string | body | タイトル本体文字列 |
型 | 属性名 | 役割 |
---|---|---|
ObjectID | _id | 本文を一意に特定する ID |
string | body | 本文本体文字列 |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.