TECH EXPERT 19日目 チャットアプリ開発 3.土台作成

3. アプリケーションの雛形の作成

キーワード:GitHub アプリケーションの状態が管理

アプリ作成後にデータベース作成

GitHub使ってローカルリポジトリ→リモートリポジトリ作成

READMEにDB設計(①②を参考に)を記載(マークダウンで)

一番下に記載 

テーブル名
カラム名
カラムの型
カラムのオプション(null false制約など)
アソシエーション

 

GitHubへのコミット、プッシュ を忘れずに行う。

 

 

README(リードミー):ソフトウェアの仕様、規格、インストール方法などを文書化したアプリケーションの説明書ファイル

 

マークダウン:マークダウンとは、文書を記述するための軽量マークアップ言語

HTMLに変換。

 

 

 

 

 

 

 

 

 

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

テーブル名
カラム名
カラムの型
カラムのオプション(null false制約など)
アソシエーション

 

README.md に記述

 

# テーブル設計

## users テーブル

| Column | Type | Options |
| -------- | ------ | ----------- |
| name | string | null: false |
| email | string | null: false |
| password | string | null: false |

### Association
- has_many :room_users
- has_many :rooms, through: room_users
- has_many :messages

## rooms テーブル

| Column | Type | Options |
| ------ | ------ | ----------- |
| name | string | null: false |

### Association
- has_many :room_users
- has_many :users, through: room_users
- has_many :messages

## room_users テーブル

| Column | Type | Options |
| ------- | ------- | ------------------------------ |
| user_id | references | null: false, foreign_key: true |
| room_id | references | null: false, foreign_key: true |

### Association

- belongs_to :room
- belongs_to :user

## messages テーブル

| Column | Type | Options |
| ------- | ------- | ------------------------------ |
| content | string |
| user_id | references | null: false, foreign_key: true |
| room_id | references | null: false, foreign_key: true |

### Association

- belongs_to :room
- belongs_to :user