mirror of https://github.com/nocodb/nocodb
Wing-Kam Wong
2 years ago
35 changed files with 657 additions and 132 deletions
@ -0,0 +1,158 @@
|
||||
name: "Release : Timely Executables" |
||||
|
||||
on: |
||||
# Triggered manually |
||||
workflow_dispatch: |
||||
inputs: |
||||
tag: |
||||
description: "Timely version" |
||||
required: true |
||||
# Triggered by release-nightly-dev.yml / release-pr.yml |
||||
workflow_call: |
||||
inputs: |
||||
tag: |
||||
description: "Timely version" |
||||
required: true |
||||
type: string |
||||
secrets: |
||||
NC_GITHUB_TOKEN: |
||||
required: true |
||||
jobs: |
||||
build-executables: |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/checkout@v3 |
||||
with: |
||||
token: ${{ secrets.NC_GITHUB_TOKEN }} |
||||
repository: 'nocodb/nocodb-timely' |
||||
- name: Cache node modules |
||||
id: cache-npm |
||||
uses: actions/cache@v3 |
||||
env: |
||||
cache-name: cache-node-modules |
||||
with: |
||||
# npm cache files are stored in `~/.npm` on Linux/macOS |
||||
path: ~/.npm |
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
||||
restore-keys: | |
||||
${{ runner.os }}-build-${{ env.cache-name }}- |
||||
${{ runner.os }}-build- |
||||
${{ runner.os }}- |
||||
- name: Cache pkg modules |
||||
id: cache-pkg |
||||
uses: actions/cache@v3 |
||||
env: |
||||
cache-name: cache-pkg |
||||
with: |
||||
# pkg cache files are stored in `~/.pkg-cache` |
||||
path: ~/.pkg-cache |
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
||||
restore-keys: | |
||||
${{ runner.os }}-build-${{ env.cache-name }}- |
||||
${{ runner.os }}-build- |
||||
${{ runner.os }}- |
||||
- name: Install QEMU and ldid |
||||
run: | |
||||
sudo apt update |
||||
# Install qemu |
||||
sudo apt install qemu binfmt-support qemu-user-static |
||||
# install ldid |
||||
git clone https://github.com/daeken/ldid.git |
||||
cd ./ldid |
||||
./make.sh |
||||
sudo cp ./ldid /usr/local/bin |
||||
|
||||
- name: Update nocodb-timely |
||||
env: |
||||
TAG: ${{ github.event.inputs.tag || inputs.tag }} |
||||
run: | |
||||
npm i -E nocodb-daily@$TAG |
||||
|
||||
git config user.name 'github-actions[bot]' |
||||
git config user.email 'github-actions[bot]@users.noreply.github.com' |
||||
|
||||
git commit package.json -m "Update to $TAG" |
||||
git tag $TAG |
||||
git push --tags |
||||
|
||||
|
||||
- uses: actions/setup-node@v3 |
||||
with: |
||||
node-version: 16 |
||||
|
||||
- name : Install dependencies and build executables |
||||
run: | |
||||
# install npm dependendencies |
||||
npm i |
||||
|
||||
# Copy sqlite binaries |
||||
rsync -rvzhP ./binaries/binding/ ./node_modules/sqlite3/lib/binding/ |
||||
|
||||
# clean up code to optimize size |
||||
npx modclean --patterns="default:*" --ignore="nc-lib-gui-daily/**,dayjs/**,express-status-monitor/**,sqlite3/**" --run |
||||
|
||||
# build executables |
||||
npm run build |
||||
|
||||
mkdir ./mac-dist |
||||
mv ./dist/Noco-macos-arm64 ./mac-dist/ |
||||
mv ./dist/Noco-macos-x64 ./mac-dist/ |
||||
|
||||
- name: Upload executables(except mac executables) to release |
||||
uses: svenstaro/upload-release-action@v2 |
||||
with: |
||||
repo_token: ${{ secrets.NC_GITHUB_TOKEN }} |
||||
file: dist/** |
||||
tag: ${{ github.event.inputs.tag || inputs.tag }} |
||||
overwrite: true |
||||
file_glob: true |
||||
repo_name: nocodb/nocodb-timely |
||||
|
||||
- uses: actions/upload-artifact@master |
||||
with: |
||||
name: ${{ github.event.inputs.tag || inputs.tag }} |
||||
path: mac-dist |
||||
retention-days: 1 |
||||
|
||||
sign-mac-executables: |
||||
runs-on: macos-latest |
||||
needs: build-executables |
||||
steps: |
||||
|
||||
- uses: actions/download-artifact@master |
||||
with: |
||||
name: ${{ github.event.inputs.tag || inputs.tag }} |
||||
path: mac-dist |
||||
|
||||
- name: Sign macOS executables |
||||
run: | |
||||
/usr/bin/codesign --force -s - ./mac-dist/Noco-macos-arm64 -v |
||||
/usr/bin/codesign --force -s - ./mac-dist/Noco-macos-x64 -v |
||||
|
||||
- uses: actions/upload-artifact@master |
||||
with: |
||||
name: ${{ github.event.inputs.tag || inputs.tag }} |
||||
path: mac-dist |
||||
retention-days: 1 |
||||
|
||||
|
||||
publish-mac-executables: |
||||
needs: sign-mac-executables |
||||
runs-on: ubuntu-latest |
||||
steps: |
||||
- uses: actions/download-artifact@master |
||||
with: |
||||
name: ${{ github.event.inputs.tag || inputs.tag }} |
||||
path: mac-dist |
||||
|
||||
- name: Upload mac executables to release |
||||
uses: svenstaro/upload-release-action@v2 |
||||
with: |
||||
repo_token: ${{ secrets.NC_GITHUB_TOKEN }} |
||||
file: mac-dist/** |
||||
tag: ${{ github.event.inputs.tag || inputs.tag }} |
||||
overwrite: true |
||||
file_glob: true |
||||
repo_name: nocodb/nocodb-timely |
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
--- |
||||
title: "Timely Build" |
||||
description: "Timely Build" |
||||
position: 5000 |
||||
category: "Engineering" |
||||
menuTitle: "Timely Build" |
||||
--- |
||||
|
||||
NocoDB provides timely build versions on Docker and Executables by compiling our source code and packaging as a deliverable so that it can |
||||
|
||||
- reduce pull request cycle time |
||||
- allow issue reporters / reviewers to verify the fix without setting up their local machines |
||||
|
||||
## Docker |
||||
|
||||
When a non-draft Pull Request is created, reopened or synchronized, a timely build for Docker would be triggered for the changes only included in the following paths. |
||||
|
||||
- `packages/nocodb-sdk/**` |
||||
- `packages/nc-gui/**` |
||||
- `packages/nc-plugin/**` |
||||
- `packages/nocodb/**` |
||||
|
||||
The docker images will be built and pushed to Docker Hub (See [nocodb/nocodb-timely](https://hub.docker.com/r/nocodb/nocodb-timely/tags) for the full list). Once the image is ready, Github bot will add a comment with the command in the pull request. The tag would be `<NOCODB_CURRENT_VERSION>-pr-<PR_NUMBER>-<YYYYMMDD>-<HHMM>`. |
||||
|
||||
![image](https://user-images.githubusercontent.com/35857179/175012097-240dab05-da93-4c4e-87c1-1c36fb1350bd.png) |
||||
|
||||
## Executables |
||||
|
||||
Similarly, we provide a timely build for executables for non-docker users. The source code will be built, packaged as binary files, and pushed to Github (See [nocodb/nocodb-timely](https://github.com/nocodb/nocodb-timely/releases) for the full list). |
||||
|
||||
Currently, we only support the following targets: |
||||
|
||||
- `node16-linux-arm64` |
||||
- `node16-macos-arm64` |
||||
- `node16-win-arm64` |
||||
- `node16-linux-x64` |
||||
- `node16-macos-x64` |
||||
- `node16-win-x64` |
||||
|
||||
Once the executables are ready, Github bot will add a comment with the commands in the pull request. |
||||
|
||||
![image](https://user-images.githubusercontent.com/35857179/175012070-f5f3e7b8-6dc5-4d1c-9f7e-654bc5039521.png) |
@ -0,0 +1,44 @@
|
||||
--- |
||||
title: "Primary Key" |
||||
description: "Primary Key" |
||||
position: 575 |
||||
category: "Product" |
||||
menuTitle: "Primary Key" |
||||
--- |
||||
|
||||
## What is a Primary Key ? |
||||
- A primary key is a special database table column designated to uniquely identify each table record. |
||||
|
||||
## What is the use of Primary Key ? |
||||
- As it uniquely identifies an individual record of a table, it is used internally by NocoDB for all operations associated with a record |
||||
|
||||
## Primary Key in NocoDB |
||||
- Primary Key that gets defined / used in NocoDB depends on how underlying table was created. Summary is captured below |
||||
1. From UI, Create new table / Import from Excel / Import from CSV |
||||
1. An `ID` [datatype: Integer] system field created by default during table creation is used as primary key |
||||
2. Additional system fields `created-at`, `updated-at` are inserted by default & can be omitted optionally; these fields can be deleted after table creation |
||||
2. Connect to existing external database |
||||
1. Existing `primary key` field defined for a table is retained as is; NocoDB doesn't insert a new ID field |
||||
2. Additional system fields `created-at`, `updated-at` are not inserted by default |
||||
3. Import from Airtable |
||||
1. Airtable record ID is marked as primary key for imported records, and is mapped to field `ncRecordId` [datatype: varchar] |
||||
2. If a new record is inserted after migration & if ncRecordId field was omitted during record insertion - auto generated string will be inserted by NocoDB |
||||
3. Computed hash value for the entire record is stored in system field `ncRecordHash` |
||||
4. Additional system fields `created-at`, `updated-at` are not inserted by default |
||||
4. Create new table using SDK / API |
||||
1. No default primary key field is introduced by NocoDB. It has to be explicitly specified during table creation (using attribute `pk: true`) |
||||
|
||||
## What if Primary Key was missing? |
||||
It is possible to have a table without any primary key. |
||||
- External database table can be created without primary key configuration. |
||||
- New table can be created using SDK / API without primary key |
||||
In such scenario's, new records can be created in NocoDB for this table, but records can't be updated or deleted [as there is now way for NocoDB to uniquely identify these records] |
||||
|
||||
#### Example : Primary Key & optional system fields during new table creation |
||||
![Screenshot 2022-06-16 at 12 15 43 PM](https://user-images.githubusercontent.com/86527202/174010350-8610b9c1-a761-4bff-a53d-dc728df47e1b.png) |
||||
|
||||
#### Example : Show System Fields |
||||
![Screenshot 2022-06-16 at 12 16 07 PM](https://user-images.githubusercontent.com/86527202/174010379-9e300d42-ad89-4653-afa2-f70fca407ca8.png) |
||||
|
||||
## Can I change the Primary Key to another column within tables ? |
||||
- You can't update Primary Key from NocoDB UI. You can reconfigure it at database level directly & trigger `metasync` explicitly |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,12 @@
|
||||
process.env.NC_BINARY_BUILD = 'true'; |
||||
(async () => { |
||||
try { |
||||
const app = require('express')(); |
||||
const {Noco} = require("nocodb"); |
||||
const httpServer = app.listen(process.env.PORT || 8080); |
||||
app.use(await Noco.init({}, httpServer, app)); |
||||
console.log(`Visit : localhost:${process.env.PORT}/dashboard`) |
||||
} catch(e) { |
||||
console.log(e) |
||||
} |
||||
})() |
@ -0,0 +1,33 @@
|
||||
{ |
||||
"name": "Noco", |
||||
"version": "1.0.0", |
||||
"description": "", |
||||
"main": "index.js", |
||||
"bin": "index.js", |
||||
"scripts": { |
||||
"test": "echo \"Error: no test specified\" && exit 1", |
||||
"start": "node index.js", |
||||
"upgrade": "npm uninstall --save nocodb && npm install --save nocodb", |
||||
"build": "npx pkg . --out-path dist --compress GZip" |
||||
}, |
||||
"pkg": { |
||||
"assets": [ |
||||
"node_modules/**/*" |
||||
], |
||||
"targets": [ |
||||
"node16-linux-arm64", |
||||
"node16-macos-arm64", |
||||
"node16-win-arm64", |
||||
"node16-linux-x64", |
||||
"node16-macos-x64", |
||||
"node16-win-x64" |
||||
] |
||||
}, |
||||
"keywords": [], |
||||
"author": "", |
||||
"license": "ISC", |
||||
"dependencies": { |
||||
"express": "^4.17.1", |
||||
"nocodb": "0.91.10" |
||||
} |
||||
} |
Loading…
Reference in new issue