ALTER TABLE test1 ADD COLUMN id SERIAL PRIMARY KEY;
ALTER TABLE test1 ADD COLUMN id INTEGER;
CREATE SEQUENCE test_id_seq OWNED BY test1.id;
ALTER TABLE test ALTER COLUMN id SET DEFAULT nextval('test_id_seq');
If you want to check if something is running at some port, you may run the following command::
Get-Process -Id (Get-NetTCPConnection -LocalPort 3306).OwningProcess
If an error is returned, then, there is nothing to run on the given port. Otherwise, it displays what the program/service is running.
package main
import (
"fmt"
)
func main() {
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, playground")
$page = ! empty( $_GET['page'] ) ? (int) $_GET['page'] : 1;
$total = count( $yourDataArray ); //total items in array
$limit = 20; //per page
$totalPages = ceil( $total/ $limit ); //calculate total pages
$page = max($page, 1); //get 1 page when $_GET['page'] <= 0
$page = min($page, $totalPages); //get last page when $_GET['page'] > $totalPages
$offset = ($page - 1) * $limit;
if( $offset < 0 ) $offset = 0;
$tourist = Tourist::updateOrCreate([...]);
if(!$tourist->wasRecentlyCreated && $tourist->wasChanged()){
// updateOrCreate performed an update
}
if(!$tourist->wasRecentlyCreated && !$tourist->wasChanged()){
// updateOrCreate performed nothing, row did not change
}
SELECT json_agg(row_to_json(ROW)) AS treeeeeee
FROM (
SELECT * FROM table_name
) row
SELECT
json_build_object(
'id', u.id,
'name', u.name,
'email', u.email,
'user_role_id', u.user_role_id,
'user_role', json_build_object(
'id', ur.id,
export function decoratorName(paramName : boolean = false) {
return function(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
const originalMethod = descriptor.value;
## I need to replace objects in arr1 with items from arr2 with same id
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);