ここに従う https://firebase.google.com/docs/firestore/quickstart?hl=ja
firebase CLIを使用 https://firebase.google.com/docs/rules/manage-deploy?hl=ja
terraformはまだbetaらしい https://registry.terraform.io/providers/hashicorp/google-beta/latest/docs/resources/firebase_project
firestoreの構成ファイルをフェッチ
firebase login
firebase init firestore
(Use an existing projectを選択)
firebase deploy --only firestore:rules
firebase deploy --only firestore:indexes
NoSQL、階層
コレクションはフォルダ、ドキュメントはファイルみたいなもの
データ検証やアクセス制御ができるスクリプト。 https://firebase.google.com/docs/firestore/security/get-started?hl=ja
inや等号とかは使えるがLIKEが使えない. https://firebase.google.com/docs/firestore/query-data/queries?hl=ja
また、検索とソートに別のキーを使用する場合は複合インデックスの登録が必要 https://firebase.google.com/docs/firestore/query-data/index-overview?hl=ja
また、DELETE FROM table WHERE ...;
相当のものもない,
できない. NoSQLの戦略として正規化しなかったり冗長にデータを持つとかしたほうが良さそう.
ある https://firebase.google.com/docs/firestore/manage-data/transactions?hl=ja
TODO そんなにまだしっかり調べられてない.
指定しないとソートや検索ができないことがある https://firebase.google.com/docs/firestore/query-data/index-overview?hl=ja
とりあえず妥協でasにしている。 firebaseのAPI自体にはできなそうなので、ajvとかzodでチェック・変換してあげると良さそう。
操作や参照はバックエンドも介することもできるが、参照のリアルタイム性を損なったりするのでフロントエンドから操作できた方がよく、APIキーは晒すことになる。 非公開ではないらしいので良さそう。 https://firebase.google.com/support/guides/security-checklist?hl=ja#understand_api_keys
参照系以外はバックエンドでも良さそう。
セキュリティはセキュリティルールで担保する必要があるはず。 https://firebase.google.com/support/guides/security-checklist?hl=ja#security_rules
クライアントID, secret, コールバックURL設定するだけ https://docs.github.com/ja/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app
https://firebase.google.com/docs/auth/web/multi-factor?hl=ja#enabling_multi-factor_authentication