## mysql – How do I use sequelize npm package to access an existing table in a remote heroku cleardb database without defining its schema in my app

In the sequelize docs Im unable to find the suitable way to get a handle on a table in a remote database. Only way currently (as mentioned in the docs) to use the models ORM way of syntax to query or manipulate data in a remote database seems to be to first define its schema in my app itself and then persist it first to get a hold of it so that we can query the existing data. I basically do not want to use sequelize.models.query method and mention my sql query explicitly like

``````sequelize.models.query("SELECT * FROM <tablename>" )
``````

and run it. But rather want to use the ORM methods of querying the data something like

``````await <table_name>.findAll({
where: {
userid: id
}
});
``````

References:

https://sequelize.org/master/index.html

https://github.com/sequelize/sequelize

## postgresql – What should the schema look like for an API-based SaaS product?

I’m building a developer tool product, which will be accessible solely by APIs. Following are a few features I’ve identified that will be needed:

1. Issuing/refreshing API keys
3. Subscriptions for API credits
4. Monitoring usage of API for each user

What should the SCHEMA look like? Are there any open examples of schemas for such a product? Is there a term for this?

Note that this would be quite similar to what something like Stripe or any API-based SaaS is doing. Just looking for a good schema example only. Any ideas?

## aws cli – How to automate the generation of the table schema json for aws dynamodb create-table?

Currently if I run `aws dynamodb create-table --generate-cli-skeleton`, it will generate a template for me to fill in column definitions etc to create a new dynamodb table.

I want to be able to dump the table layout from another dynamodb table and use it as a json input to the `create-table` command.

However when I use `aws dynamodb describe-table` to generate a json, it is structurally different from the cli skeleton file.

What is the easier way to create such a json file based on an existing table?

## postgresql – pg_restore showing errors when specifying schema when backing up with pg_dump

I have created two different dump files one without specifying the schema, another specifying the `public` schema

without specifying the public schema’

``````pg_dump -h IP_ADDRESS -p 5432 -U my_user -Fc my_db  > my_db_allschema.dump
``````

and the pg_dump statement when specifying the public schema

``````pg_dump -h IP_ADDRESS -p 5432 -U my_user -Fc my_db -n public > my_db_publicschema.dump
``````

When using pg_restore to restore the dump files, I get errors with the dump file that was generated when specifying the public schema.

``````postgres@debian:~\$ pg_restore -h localhost -p 5432  -U my_user -d my_db my_db_publicschemaonly.dump
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 8; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR:  schema "public" already exists
Command was: CREATE SCHEMA public;

pg_restore: from TOC entry 212; 1259 18102 TABLE abandoned_url real_estate
pg_restore: error: could not execute query: ERROR:  function public.gen_random_uuid() does not exist
LINE 2:     id uuid DEFAULT public.gen_random_uuid() NOT NULL
^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
Command was: CREATE TABLE public.abandoned_url (
id uuid DEFAULT public.gen_random_uuid() NOT NULL
);
``````

Looking at this statement that throws an error

``````CREATE TABLE public.abandoned_url (
id uuid DEFAULT public.gen_random_uuid() NOT NULL
);
``````

The reason it’s throwing an error is because pg_dump has put `public` before `gen_random_uuid()`, the following statement works fine when removing public before gen_random_uuid()

``````CREATE TABLE public.abandoned_url (
id uuid DEFAULT gen_random_uuid() NOT NULL
);
``````

Am I creating the dump file incorrectly? Could this be a bug in pg_dump?

## set theory – Question about empty set uniqueness proof using Set Existence, Extensionality, and the Comprehensive Schema.

I recently began reading, “The Foundations of Mathematics” by Kenneth Kunen and am having some difficulty understanding the rationale behind one of the very early proofs. The proof is about demonstrating the uniqueness of the empty set using the following 3 Axioms that Kunen establishes early in the book:

A. Set Existence: $$exists x (x=x)$$ …which Kunen will refer to as Axiom $$0$$

B. Extensionality: $$forall x,y big( forall z (z in x leftrightarrow z in y) rightarrow x=ybig )$$

C. Comprehension Schema: $$forall z big ( exists y forall x (x in y leftrightarrow xin z land varphi(x) big)$$

I’ve seen the proof referenced many times so I am conceptually familiar with it…but I am having some confusion regarding the formal implementation of it. Kunen’s proof is as follows:

(1) $$text{emp}(x):=forall z (znotin x)$$

(2) By Extensionality, $$text{emp}(x) land text{emp}(y) rightarrow x=y$$

(3) To prove that $$exists y (text{emp}(y))$$, start with any set $$z$$ (there is one by Axiom $$0$$) and apply comprehension with $$varphi (x)$$ a statement that is always false (for example, $$x neq x$$) to get a such that $$forall x (x in y leftrightarrow text{FALSE})$$ – i.e. $$forall x (x notin y)$$.

Combining (2) with (3) demonstrates that the empty set $$emptyset$$ is unique.

I have several questions:

Firstly, how can we claim that $$x neq x$$ is always false. By Set Existence, we claim that there is at least one set with the property that it is equal to itself…i.e. the relation “$$=(x,x)$$” holds true. In order to claim that $$x neq x$$ is always false for any object $$x$$, shouldn’t our Set Existence axiom be of the form $$forall x (x=x)$$?

Secondly, given that Set Existence is presumably written correctly, what exactly is its purpose? Kunen’s remark in (3), “…there is one by Axiom $$0$$…” seems to suggest that this axiom asserts that our domain of discourse is non-empty. But what exactly does that mean? My interpretation of a statement like that is, “Ok…so we know that we have at least one object in our domain of discourse, but no comment is made regarding whether have more than one“. Assuming that interpretation is correct, how is it that I can even generate multiple empty sets (say $$emptyset^*$$ and $$emptyset ‘$$) in (3) when the claim of the Comprehension Schema is that, “For any given set $$z$$ I can construct at least one set $$y$$ such that…”?

Said differently, if I only know for sure that one object $$z$$ exists (namely the $$z$$ that would be guaranteed to exist by Set Existence), shouldn’t I only be able to generate a single empty set from it…i.e. because the Comprehension Schema states that I can construct at least one subset…but makes no comment about whether or not a can construct more than one ($$emptyset^*$$ would be the first instance of an empty set construction but how could I also be guaranteed to construct the other $$emptyset’$$?). The only thing I could think to do is use a different $$varphi$$ (call it $$psi$$) that also always evaluates the FALSE but I am unsure if that is the correct route.

Hopefully this rambling was expressed in a comprehensible manner. Any insight is greatly appreciated!

## database design – Data Schema For Stock Control / Multi Source Inventory

I’m working on a project that involves stock control with multiple stock sources and sales channels. The overall hierarchy I’ve got so far looks like this;

``````Sales Channels <---- Allocated Stock Sources <---- Stock Locations (warehouses) <--- Stock Sub Locations <---- Shelf / Bin Locations
``````

As far as rules go for how these entities relate to each other I’ve come up with this;

The system must have one or more sales channels, each sales channel
must have 1 or more stock sources, a stock source must have 1 or more
stock locations (warehouses / buildings / distribution centres ), a
stock location may have 1 or more Bin/Shelf locations.

A product may have 1 or more stock locations, may have one or more sub
locations in those stock locations and may have one or more Shelf / Bin
location.

First off, is this a solved problem where some reference schema exists I could utilise and save myself some headaches?

If there isn’t a reference design for this situation, Am I best to build a 1 to Many relationship to assign stock to a sub location(s) and another 1 to Many relationship for Shelf Locations (if exists)

## Database schema for job offers with some common attributes

I’m trying to design a database in order to store IT job offers. My data comes from 4 different websites and unfortunately only part of their attributes (column names) are common. It looks like this:

``````Website 1: title, overall experience level
Webiste 2: title, overall experience level, skills required, skills nice to see
Website 3: title, overall experience level, skills required, level of required skills (junior or mid or senior)
Webiste 4: title, overall experience level, skills required, level of required skills (in years), skills nice to see, language, level of langauge
``````

I would like to know how would you design a database with this kind of data? I did some research and found that it can be done in different ways:

Approach 1: only one table with all attributes (there will be a lot of nulls) but to be honest I think it’s bad idea.

Approach 2: one table storing common attributes to all websites and rest of attributes in separate tables. Also I must notice that each job offer has multiple values in `skills required` and `skills nice to see attributes` so I think these two must be in many-to-many relationship with `JobOffer table`

Approach 3: Four tables with attributes assigned to each of websites (so each table represents each website with its atrributes). And like in previous approach `skills required` and `skills nice to see` are in many-to-many relationship with almost (except `WEBSITE1` table) every website table

Approach 4: Your own approach because none of these above fit well to this problem. (I’ve never been designing database before so I’m aware that all 3 approaches proposed by me could be wrong)

## seo – Google rich snippet always shows “Sold out” for available (ld+json) offer schema

We have listing menu items for the restaurant and something wrong, it always shows “Sold Out” in Google’s search results. The items given to Gooogle as ld+json schema with the availability property.

Snippet part (with liquid variables from backend):

``````<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Restaurant",
"name": "{{ account.business_name | replace: '"', "'" }}",
"description": "{{ location_description | replace: '"', "'" }}",
"acceptsReservations": "{{ reservations_are_avalible }}",
"url": "{{ account.website_url | replace: '"', "'" }}",
"logo": "{{ account.logo_medium_url }}",
"image": "{{ account.logo_medium_url }}",

{
"name": "{{ menu.name | replace: '"', "'" }}",
{
"name": "{{ menu_section.name | replace: '"', "'" }}",
"image": "{{ account.logo_medium_url }}",
{% for item in menu_section.items %}
{
"name": "{{ item.name | replace: '"', "'" }}",
"description": "{{ item.description | replace: '"', "'" }}"
{% if item.pricepoints(0).price != blank %}
,"offers": {
"@type": "Offer",
"price": "{{ item.pricepoints(0).price }}",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock"
}
{% endif %}
}
{% if forloop.last == false %}
,
{% endif %}
{% endfor %}
)
}
{% if forloop.last == false %}
,
{% endif %}
{% endfor %}
)
}
{% if forloop.last == false %}
,
{% endif %}
{% endfor %}
)
}
</script>
``````

When I search the “borealis grille menu kitchener” I see each item listed as “Sold out”:

## 7 – How do I allow HTML markup in Google Jobs metatag schema?

Using Schema.org Metatag module for Google Jobs, how would I allow in description HTML markup?

I’m using the following module https://www.drupal.org/project/schema_metatag

All the patches I tried aren’t working so far.

Related to my issue

https://www.drupal.org/project/schema_metatag/issues/2995311

As I’m quite new to Drupal I do not really know how to debug this issue or apply a custom workaround

## Schema Blog Microdata(JSON-LD) [closed]

Blog Page (BULK) How to write the schema diagram of the listed page? and how to list the blogs in the blog page?
likewise blog/category,blog/tag,blog-detail

http://example.com/blog < bulk list

http://example.com/blog/kategori < bulk list

http://example.com/blog/tag < bulk list

http://example.com/blog/blog-detail < page with blog detail