Giter Club home page Giter Club logo

billet-migrations's Introduction

Billet migrations

Standart migrations of billet application which is able to be reused many times.

To add migration to your rails project, run:

bin/rails app:template LOCATION=https://raw.githubusercontent.com/cimon-io/billet-migrations/master/.billet.rb

And follow instructions.

Available migrations

Uid feild

Add autogenerated field which contains the UID.

Counter cache

Add field child_count alike it counter_cache, but on database level.

Belongs Directly

Lets say we have three tables which represent ActiveRecord models which belongs to each other. A company has many projects, a project has many items. This migration add field company_id to items table and keep it actual.

Readable slug

Add field slug to generate it with incremental principle with mask XX-AAA-0000 where XX -- two speciefic letters for a table and AAA letters which is unique for each day. For example, there are two tables companies and projects exists with prefixes CO and PR. The first company created will have slug CO-SDF-0001, the second one -- CO-SDF-0002. A project at the same day will have slug PR-SDF-0001, PR-SDF-0002, PR-SDF-0003, etc. Next day three letters prefix will be different. Lets say a company created next day will have slug CO-TRW-0001, CO-TRW-0002, etc. The projects next day will have slugs PR-TRW-0001, PR-TRW-0002, PR-TRW-0003, etc.

Timestamps

Set default CURRENT_TIMESTAMP value for created_at and updated_at fields. Also updates updated_at field when record is changed or touched.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cimon-io/billet-migrations. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The scripts are available as open source under the terms of the MIT License.

billet-migrations's People

Contributors

aratak avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

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.