英文:
Keep a base version of a file on remote repository but an updated version locally
问题
我有2个文件,database.db
和 schema.sql
。schema.sql
是使用以下命令在数据库中生成的:
sqlite3 database.db < schema.sql
然后 database.db
会在本地动态更新。我想要解决的问题是,我希望在远程仓库上的 database.db
版本仅包含在 schema.sql
中声明的表和表行。目标是避免在 database.db
中出现合并冲突,因为我们有多人在此存储库上工作,而且我们可能需要不同的数据库。
到目前为止,我只尝试将 database.db
添加到存储库的 .gitignore
中,但这没有起作用。
英文:
I have 2 files, database.db
and schema.sql
. schema.sql is generated in the database using the command:
sqlite3 database.db < schema.sql
The database.db is then updated dynamically locally. The question I want solved is that the version of database.db I want on my remote repository is the one that just contains the tables and table rows as declared in schema.sql. The goal here is that I don't want merge conflicts in database.db as we are multiple people working on this repository and we are likely to want to have different databases.
So far I have only tried adding database.db to the repository's .gitignore which doesn't work.
答案1
得分: 0
我想要解决的问题是,我希望在我的远程存储库上的
database.db
版本只包含在schema.sql
中声明的表和表行。
然后使用两个不同的database.db
文件:
- 一个(
database.gen.sql
)被跟踪和推送,只包含在schema.sql
中声明的表和表行:sqlite3 database.gen.sql < schema.sql
- 一个(
database.sql
)从database.gen.sql
复制,然后由开发人员私下修改,这意味着可以将其添加到.gitignore
。
英文:
> The question I want solved is that the version of database.db I want on my remote repository is the one that just contains the tables and table rows as declared in schema.sql
Then work with two different database.db files:
- one (
database.gen.sql
) which is tracked and pushed, and just contains the tables and table rows as declared inschema.sql
:sqlite3 database.gen.sql < schema.sql
- one (
database.sql
) which is is copied fromdatabase.gen.sql
and then modified privately by developers, meaning this one can be added to the.gitignore
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论