Create a local Hasura project w/ tracking metadata & deploy to Hasura Cloud with GitHub Integration
HTML-код
- Опубликовано: 2 июл 2024
- Everything you need to know about creating a local Hasura project and publishing it to the cloud.
Signup for Hasura here cloud.hasura.io/signup?...
You can find the github repo here: github.com/hasura/build-with-...
Start from the beginning here: • Intro to creating a fu...
0:00 Intro
0:22 Init Hasura metadata
0:52 Adding Docker Compose
01:50 Modifying Docker Compose
02:24 Running Hasura console with the CLI
03:19 Adding a data source
03:48 Looking at the data model
04:29 Adding the data to Hasura
04:37 Tracking migrations
05:05 Tracking tables and relations
06:06 Looking at the generated metadata
06:35 Creating CI/CD with the GitHub Integration
07:36 Connecting GitHub to Hasura Cloud
07:54 Creating a new project in Hasura Cloud
08:13 Configuring our Cloud project
10:01 Configure the GitHub Integration
11:30 In the next video
-----
🚀 Hasura makes your data instantly accessible over a real-time GraphQL API, so you can build and ship modern apps and APIs faster. Hasura connects to your databases, REST servers, GraphQL servers and third party APIs (eg: Stripe, Salesforce) to provide a unified realtime GraphQL API across all your data sources instantly.
Check out our features: hasura.io
Find us on Twitter: / hasurahq
Join our community: hasura.io/discord
----- Наука
How do you get metadata and migrations working on local? It seems to work updaing the github repo and applying to hasura cloud. But if pulling the project on a new computer (or reinitialising the project) and running the commands doesn't work, and no metadata or migrations are applied to my local.
Thank you for this tutorial.
I have a question: what if instead of starting from our local environment, we started from the cloud and setup the db, tables and other relevant initial data.
how do we then take that cloud instance and set it up locally as well, tracking all of the data models as well? I would like to know if there are resources that tackle this problem.
Hi, you are probably looking for the Hasura CLI command, create migrate from server. You can read more about it here. hasura.io/docs/latest/hasura-cli/commands/hasura_migrate_create/#examples
@hasura where can we get the SQL query that was copy pasted at 4:40?
SET check_function_bodies = false
;
CREATE TABLE friend
(id serial NOT NULL, "name" text NOT NULL, CONSTRAINT friend_pkey PRIMARY KEY(id))
;
CREATE TABLE pizza(
id serial NOT NULL, title integer NOT NULL,
CONSTRAINT pizza_pkey PRIMARY KEY(id)
);
CREATE TABLE pizza_order(
id serial NOT NULL,
pizza_id integer NOT NULL,
friend_id integer NOT NULL,
CONSTRAINT pizza_order_pkey PRIMARY KEY(id)
);
CREATE TABLE pizza_topping(
id serial NOT NULL,
title text NOT NULL,
available boolean NOT NULL,
emoji text NOT NULL,
CONSTRAINT pizza_topping_pkey PRIMARY KEY(id)
);
CREATE TABLE pizza_topping_pizza(
id serial NOT NULL,
pizza_id integer NOT NULL,
pizza_topping_id integer NOT NULL,
CONSTRAINT pizza_topping_pizza_pkey PRIMARY KEY(id)
);
CREATE TABLE table1(id integer NOT NULL, CONSTRAINT table1_pkey PRIMARY KEY(id))
;
ALTER TABLE pizza_topping_pizza
ADD CONSTRAINT pizza_topping_pizza_pizza_id_fkey
FOREIGN KEY (pizza_id) REFERENCES pizza (id);
ALTER TABLE pizza_order
ADD CONSTRAINT pizza_order_pizza_id_fkey
FOREIGN KEY (pizza_id) REFERENCES pizza (id);
ALTER TABLE pizza_order
ADD CONSTRAINT pizza_order_friend_id_fkey
FOREIGN KEY (friend_id) REFERENCES friend (id);
ALTER TABLE pizza_topping_pizza
ADD CONSTRAINT pizza_topping_pizza_pizza_topping_id_fkey
FOREIGN KEY (pizza_topping_id) REFERENCES pizza_topping (id);
You can do that by installing luna modeller/moon modeller, which is a database modeller.Copy the schema in as shown at 4:08. It is easy if you know entity relationship diagrams.there you have an option to build script and your job is done
@HasuraHQ please tell us where you get that sql query which were copy and pasted at 4:40?
SET check_function_bodies = false;
CREATE TABLE friend
(id serial NOT NULL, "name" text NOT NULL, PRIMARY KEY(id))
;
CREATE TABLE pizza(
id serial NOT NULL, title integer NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE pizza_topping(
id serial NOT NULL,
title text NOT NULL,
emoji text NOT NULL,
avaliable boolean NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE pizza_order(
id serial NOT NULL,
pizza_id integer NOT NULL,
friend_id integer NOT NULL,
PRIMARY KEY(id)
);
CREATE TABLE pizza_topping_pizza(
id serial NOT NULL,
pizza_topping_id integer NOT NULL,
pizza_id integer NOT NULL,
PRIMARY KEY(id)
);
ALTER TABLE pizza_topping_pizza
ADD CONSTRAINT pizza_pizza_topping_pizza
FOREIGN KEY (pizza_id) REFERENCES pizza (id) ON DELETE Cascade;
ALTER TABLE pizza_topping_pizza
ADD CONSTRAINT pizza_topping_pizza_topping_pizza
FOREIGN KEY (pizza_topping_id) REFERENCES pizza_topping (id) ON DELETE Cascade;
ALTER TABLE pizza_order
ADD CONSTRAINT firend_pizza_order
FOREIGN KEY (friend_id) REFERENCES friend (id) ON DELETE Cascade;
ALTER TABLE pizza_order
ADD CONSTRAINT pizza_pizza_order
FOREIGN KEY (pizza_id) REFERENCES pizza (id) ON DELETE Cascade;
What do you put in the value of Custom Env Vars?? The one that was blacked out at 9:05?
I'm stuck because it says Adding data source failed Inconsistent object: connection error
Your postgres connection string, usually starts with something like postgresql://
@@HasuraHQ I put that whole string but it doesn't work. : (
Help please. I cannot figure out what to do next.
I'd suggest reaching out on Discord to see if someone there can have a look at your connection string. Which provider are you using? On Discord we have better ways to look at individual issues. Hope to see you over there!
@@HasuraHQ I'm following the tutorial step by step. What is the connection string supposed to look like? I'm using the default one? Is it supposed to be changed?
Hi @@antdx316, Here's one from a database hosted on Railway. postgresql://:@containers-us-west-137.railway.app:8055/railway
be sure to swap and with your own values (don't include ). Hope that helps!
Helloo,
Can you tell which CLI/Terminal is that ?
Warp - freemium terminals aren't everyone's cup of tea, but the author likes it! www.warp.dev/
would be nice if provide resoursed userd in description
Incoming niceness github.com/hasura/build-with-hasura-byp
@@HasuraHQ nice thanks.