Hide columns with specific names in datagrip - datagrip

How would I go about hiding columns with a specific names? I have tables in my database with a few audit fields always named the same thing in each table:
created_at
updated_at
created_by
updated_by
This is an annoyance to the application developers who only wish to see the fields relevent to them. Is there a setting I can change to not show this on every table in the database sidebar?

Unfortunately, now it's impossible in DataGrip :(
Please, comment and follow: https://youtrack.jetbrains.com/issue/DBE-1387

Related

How to specify in supabase a field should only have default value?

I'm making a basic chat app using supabase.
I've figured out how to make it so users can only create/edit their profile and send messages from their profile using RLS, by checking if their id matches with the auth.id.
The problem I'm facing is, that I don't want users to be able to insert messages with wrong creation dates.
If no date is specified the default value is correct. But currently there is no check for the creation date.
Can I specify, that the creation date field has to be sent empty?
Is there maybe a better solution?
One thing you can do is you can override the created_at field with the current server timestamp using triggers.
Code not verified, so you might have to make some small adjustments, but the idea is this:
create extension if not exists moddatetime schema extensions;
-- assuming the table name is "messages", and a timestamp column "created_at"
-- this trigger will set the "created_at" column to the current timestamp for every insert
create trigger
handle_created_at before insert
on messages
for each row execute
procedure moddatetime(created_at);

I don't understand. I'm trying to create the first table for a database in Oracle APEX

It's telling me to provide a FK and a table reference when there is no FK in the table, nor a relevant table to reference.
You do not need to define a FK. Just scroll down and click Next.

Laravel automatically add "on update CURRENT_TIMESTAMP" to some certain columns

My migration is like so:
$table->bigIncrements('id');
$table->timestamp('from_date');
$table->timestamp('to_date');
$table->timestamps();
The problem is that when I migrate it, the second one which is from_date automatically gets on update CURRENT_TIMESTAMP attribute so it means when I update other columns this column will be updated too. That's what I don't want. How can I prevent it?
You can add nullable to the column in order to remove the constraint.
$table->timestamp('from_date')->nullable();
Unfortunately I think that this is the only solution. Then you can add a form validation in order to prevent setting null value for the field.
-- EDIT
$table->timestamp('from_date')->default(DB::raw('CURRENT_TIMESTAMP'));
// or
$table->timestamp('from_date')->useCurrent();
Try this as well, I believe this is what the created_at has.
You need to make the DateTime column nullable, then MySQL won't add that. By default, MySQL adds that to the first timestamp in the table, unless explicitly told not to (via allowing a null value for the field). This is a MySQL thing, not a Laravel thing.
$table->timestamp('colName')->nullable();
Read :
Automatic Initialization and Updating for TIMESTAMP and DATETIME - MYSQL DOCS
Laravel & MySQL auto-adding “on update current_timestamp()” to timestamp fields
This behaviour is native to MySQL. You can read about it on this documentation page:
TIMESTAMP and DATETIME columns have no automatic properties unless they are specified explicitly, with this exception: If the explicit_defaults_for_timestamp system variable is disabled, the first TIMESTAMP column has both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP if neither is specified explicitly.
The docs go on to specify that there are two strategies for avoiding this behaviour:
Enable the explicit_defaults_for_timestamp variable in your database configuration.
When defining your timestamp column, specify a DEFAULT or make the column nullable.

how to make oracle apex wizard steps with multiple related tables?

In Oracle Apex, I have some related tables i.e:
**Person Table**
Id
Name
**Person_Contact Table**
Id
PersonFK
Tel
Address
**Person_Account Table**
Id
PersonFK
BankName
AccountNumber
these are 1-to-1 tables and PersonFK is the Foreign Key.
Now, I want to create a wizard with 3 steps.
how can I do this?
should I define 3 tables with 1-to-1 relation (like above) or create just one big table?
and
what is the best practice in Oracle Apex (in wizard steps forms) for this purpose?
If you are sure that all three tables will remain have common attributes then the option of single table is fine. More detail can be find
here

Maximum number of columns in a LINQ to SQL object?

I have 62 columns in a table under SQL 2005 and LINQ to SQL doesn't handle the updates though the reading would work just fine, I tried re-adding the table to the model, created a new data model but nothing worked, I'm guessing I've hit the maximum number of columns limit on an object, can anyone explain that ?
I suspect there is some issue with an identity or timestamp column (something autogenerated on the SQL server). Make sure that any column that is autogenerated is marked that way in the model. You might also want to look at how it is handling concurrency. If you have triggers that update any values on the row after it is updated (changing values) and it is checking all columns on updates, this would cause the update to fail. Typically I create my tables with a timestamp column -- LINQ2SQL picks this up when I generate the model and uses it alone for concurrency.
Solved, either one of the following two
-I'm using a UniqueIdentifier column that was not set as Primary key
-Set Unique ID primary key, checked the properties of the same column in Server Explorer and it was still not showing as Primary key, refreshed the connection,dropped the same table on the model and voila.
So I assume I made a change to my model some time before, deleted the table from the model and added the same from the Server explorer without refreshing the connection and it never used to work.
Question is, does VS Server Explorer maintain it's own table schema and requires connection refresh everytime a change is made in the database ?
There is no limit to the number of columns LINQ to SQL will handle.
Have you got other tables updating successfully?
What else is different about how you are accessing the table content?

Resources