3.0.1-alpha.5011.0 • Published 6 years ago

@energyweb/migrations v3.0.1-alpha.5011.0

Weekly downloads
30,981
License
GPL-3.0-or-later
Repository
github
Last release
6 years ago

@energyweb/migrations

This repository is used to deploy all the contracts and migrate all the data for the Origin project of the Energy Web Foundation.

Running

Command line options:

  -c, --config <config_file_path>  path to the config file
  -s, --seed-file <seed_sql_path>  path to the SQL file that will be used for seeding the database
  -e, --env <env_file_path>        path to the .env file or system variables when not set
  -f, --force                      WARNING: Drop existing and migrate, allowed only when MODE is not set to
                                   PRODUCTION (default: false)

In a development mode use:

yarn start <options>

Required configuration variables

  • WEB3 - web3 endpoint url
  • DEPLOY_KEY - private key to be used for smart contracts deployment
  • DATABASE_URL - formatted as postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...] - has precedence over DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE
  • DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE - database connection details

Default configuration

Note: When no DATABASE_URL and DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_DATABASE provided, the migration program will default to:

DB_HOST = 'localhost'
DB_PORT = 5432
DB_USERNAME = 'postgres'
DB_PASSWORD = 'postgres'
DB_DATABASE = 'origin'

Migrations program will read the .env file and process.env by default, this location of .env file can be specified using -e switch

Migrations

Migrations currently support 2 modes:

  1. Initial migration
  2. Forced migration

Initial migration

This is a default mode, migrations will check the existence of the configuration tables in the provided database connection parameters. Process will perform:

  • creates public schema if not exists
  • creates tables using src/scheme/create_tables.sql
  • deploy issuer and registry contracts from @energyweb/issuer package
  • stores initial configuration from provided -c JSON file path
  • stores the demo/seed data from provided -s sql file

Forced migration

When -f parameter is provided, migrations will drop existing DB and run the initial migration

3.2.6

4 years ago

3.2.5

4 years ago

3.2.8

4 years ago

3.2.7

4 years ago

3.2.4

5 years ago

3.2.3

5 years ago

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.10

5 years ago

3.1.9

5 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

6 years ago

3.1.4

6 years ago

3.1.3

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.1.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago