elixir - 在创建表中添加对另一个表的引用
问题描述
如何在我的 sql 脚本中添加对另一个表的引用?
在 Ecto.Schema 中,我需要将其添加到 Create Table SQL 脚本中
has_one(:contact, Contact, foreign_key: :user_id, references: :id, where: [friend: true] )
我的 sql 脚本看起来像
create table somemodule.table
user_id INT,
...
解决方案
推荐阅读
- mysql - mysql 使用连接表和计数将动态日期从行转置到列
- sql-server - 将 Python 库导入 SQL Server
- azure-devops - 用于 Runbook 的 Azure ARM 模板,其中包含来自 Azure Git Repo 的 Powershell 文件
- javascript - JS如何更新列表项
- python-3.x - tika-python 的语言检测不起作用
- css - 底部边距对 App Bar 间距没有影响
- c++ - 将 utf16 宽 std::wstring 转换为 utf8 窄 std::string 以获取稀有字符时出现问题
- firebase - 将数组添加到 Cloud Firestore (Flutter/Dart)
- java - Spring 文档暗示 @EnableRetry 和 @Retryable 与 spring 的 feign 客户端一起工作。但是好像没有
- gitlab - 为什么我不能 ssh 到从 gitlab 创建的新地形化 EC2 实例?