Giter VIP home page Giter VIP logo

Comments (9)

taisph avatar taisph commented on August 17, 2024 7

It would be useful with common guideline for sql init and migration files. There are too many options. ๐Ÿ˜†

from project-layout.

taisph avatar taisph commented on August 17, 2024 7

Just for the fun of it i'll add another option: /api/db. Those sql file represent the data model for your data store and the /api folder, in general, is a good place for the data model and interface descriptions (with swagger, protobufs, json schema, sql, etc) :-)

I don't like the idea of putting db in the /api folder. There are go-based projects that do not necessarily have anything to do with serving an API but still uses a database backend.

/db (and /db/migrations) seems more like the right fit to me.

from project-layout.

sfaujour avatar sfaujour commented on August 17, 2024 4

Im also at the point that there should be a /db folder in the root for fixtures/migrations.

from project-layout.

kcq avatar kcq commented on August 17, 2024 1

It depends on your application design. Those files might be in the same directory with your corresponding packages and/or tools. The /configs directory is another option (e.g., /configs/sql/, /configs/templates, /configs/localization). This is what I usually do. Good option if you are ok with those files as separate dependencies you load at run time. You can also make them root level directories (e.g., /sql, /templates, /localization). This is a good option too because it follows the /api directory pattern especially if you intend to embed those resources in your binary.

from project-layout.

kcq avatar kcq commented on August 17, 2024 1

That's definitely an option too! Logos, images and other generic assets usually go there, but there's nothing prevents you from putting other things there :-)

from project-layout.

sturfee-petrl avatar sturfee-petrl commented on August 17, 2024

I keep email templates at /assets because I thought it was exact place where it should be(?)

from project-layout.

unkeep avatar unkeep commented on August 17, 2024

@taisph, @kcq might be:
a) scripts/pg-migrations (not sure scripts is intended to contain sql)
b) db/pg-migrations (a new db top-level dir)
c) assets/pg-migrations (I afraid assets would become a "trash" dir, if so let it be named etc right away)

from project-layout.

taisph avatar taisph commented on August 17, 2024

I'm leaning towards /db or /sql. The former to avoid assuming the database is always SQL.

from project-layout.

kcq avatar kcq commented on August 17, 2024

A top level /db makes sense (or /sql if you don't care about keeping it generic :-)).

Just for the fun of it i'll add another option: /api/db. Those sql file represent the data model for your data store and the /api folder, in general, is a good place for the data model and interface descriptions (with swagger, protobufs, json schema, sql, etc) :-)

from project-layout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.