Code and tools for building the sample databases used for FarmData2 development.
All of the following documentation assumes that operations are performed within the FarmData2 Development Environment.
Install the dependencies by:
- Change into the
FD2-SampleDBs
directory - run
npm install
Ensure that the FarmData2 repository has also been cloned.
git clone https://github.com/FarmData2/FarmData2.git
Copy the useful libraries from the FarmData2 repository:
- Change into the
FD2-SampleDBs
directory bin/buildFD2Libs.bash
The following scripts contained in the src
directory are used to build the sample databases:
baseDB/buildBaseDB.bash
: Builds an empty farmOS database. This is used as a base for building other sample databases.sampleDB/buildSampleDB.bash
: Builds a sample farmOS database with a small set of records for testing FarmData2 features during development.
The bin/installDB.bash
script can be used to install any of the compressed database in the dist
directory. Running installDB.bash
with no command line arguments displays a list of the available databases. Alternatively, the name of a db.*.tar.gz
file in the /dist
directory can be specified on the command line.
The structure of a farmOS record (e.g. asset, log, quantity, term, user) can be displayed using the command:
npm run printlog <type>
where <type>
is one of the record types. Run the command without the <type
argument to see a list of all of the record types.
The buildFD2libs.bash
command will ensure that the libraries from FarmData2 that are used are copied into this repository. A directory for each library is created in the src/libraries
directory. The imports within the relevant library files are adjusted to the directory structure used here.
The libraries should be maintained only from the FarmData2 repository. When new a library is updated in FarmData2 or added to FarmData2 and the changes are needed here the buildFD2libs.bash
and .gitignore
files should be updated and the buildFD2libs.bash
script should be run again so that the changes are copied and adapted.
To change, modify, update, add a database:
- Prerequisites:
- Fork the
FD2-SampleDBs
upstream repository - Clone your fork into the FarmData2 Development Environment
- Fork the
- Ensure that your
development
branch is synchronized with theupstream
- Create a new feature branch from the
development
branch - Make and test changes in your feature branch
- Run the appropriate script(s) to build the database
- Install and test that the new database works
- See Manually Installing a Database above
- Commit to your feature branch:
- The changes you have made to the code.
- The newly created database files (e.g.
db.base.tar.gz
)
- Pull and merge any new changes to the
development
branch into your feature branch - Create a pull request to the
development
branch in the upstream
A maintainer will:
- Review your pull request and provide feedback
- If/when appropriate squash merge your pull request into the
development
branch- The squash merge commit message must be a conventional commit message.
- See Conventional Commits
- In addition,
BREAKING CHANGE:
must be included in the footer of the commit message to produce a breaking change.- See Semantic Release
- This will create a pre-release
vX.Y.Z-development.n
- X.Y.Z is the semantic version of the next release if created at the moment
- n is a sequence number for pre-releases with the same semantic version number.
- The squash merge commit message must be a conventional commit message.
When changes warranting a new release have been added to the development
branch a maintainer will create a new release by:
- Updating the
production
anddevelopment
branches from the upstream. - Fast-forward merging the latest
development
branch into theproduction
branch - Pushing the
production
branch to the upstream- This will create a new release
vX.Y.Z
- X.Y.Z is the semantic version of the release
- All but the most recent
development
pre-release will be deleted - The
CHANGELOG.md
file in theproduction
branch is updated with the changes added - The
production
branch is backmerged into thedevelopment
branch
- This will create a new release
Then you will need to:
- Update the
production
anddevelopment
branches from the upstream to get the backmergedCHANGELOG.md
file.